You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

95 lines
3.3 KiB

  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. using MQTTnet.Diagnostics;
  5. using System;
  6. using System.Threading;
  7. using System.Threading.Tasks;
  8. namespace MQTTnet.TestApp
  9. {
  10. public static class Program
  11. {
  12. public static void Main()
  13. {
  14. Console.WriteLine($"MQTTnet - TestApp.{TargetFrameworkProvider.TargetFramework}");
  15. Console.WriteLine("1 = Start client");
  16. Console.WriteLine("2 = Start server");
  17. Console.WriteLine("3 = Start performance test");
  18. Console.WriteLine("4 = Start managed client");
  19. Console.WriteLine("5 = Start public broker test");
  20. Console.WriteLine("6 = Start server & client");
  21. Console.WriteLine("7 = Client flow test");
  22. Console.WriteLine("8 = Start performance test (client only)");
  23. Console.WriteLine("9 = Start server (no trace)");
  24. Console.WriteLine("a = Start QoS 2 benchmark");
  25. Console.WriteLine("b = Start QoS 1 benchmark");
  26. Console.WriteLine("c = Start QoS 0 benchmark");
  27. Console.WriteLine("d = Start server with logging");
  28. Console.WriteLine("e = Start Message Throughput Test");
  29. var pressedKey = Console.ReadKey(true);
  30. if (pressedKey.KeyChar == '1')
  31. {
  32. Task.Run(ClientTest.RunAsync);
  33. }
  34. else if (pressedKey.KeyChar == '2')
  35. {
  36. Task.Run(ServerTest.RunAsync);
  37. }
  38. else if (pressedKey.KeyChar == '3')
  39. {
  40. Task.Run(PerformanceTest.RunClientAndServer);
  41. }
  42. else if (pressedKey.KeyChar == '4')
  43. {
  44. Task.Run(ManagedClientTest.RunAsync);
  45. }
  46. else if (pressedKey.KeyChar == '5')
  47. {
  48. Task.Run(PublicBrokerTest.RunAsync);
  49. }
  50. else if (pressedKey.KeyChar == '6')
  51. {
  52. Task.Run(ServerAndClientTest.RunAsync);
  53. }
  54. else if (pressedKey.KeyChar == '7')
  55. {
  56. Task.Run(ClientFlowTest.RunAsync);
  57. }
  58. else if (pressedKey.KeyChar == '8')
  59. {
  60. PerformanceTest.RunClientOnly();
  61. return;
  62. }
  63. else if (pressedKey.KeyChar == '9')
  64. {
  65. ServerTest.RunEmptyServer();
  66. return;
  67. }
  68. else if (pressedKey.KeyChar == 'a')
  69. {
  70. Task.Run(PerformanceTest.RunQoS2Test);
  71. }
  72. else if (pressedKey.KeyChar == 'b')
  73. {
  74. Task.Run(PerformanceTest.RunQoS1Test);
  75. }
  76. else if (pressedKey.KeyChar == 'c')
  77. {
  78. Task.Run(PerformanceTest.RunQoS0Test);
  79. }
  80. else if (pressedKey.KeyChar == 'd')
  81. {
  82. Task.Run(ServerTest.RunEmptyServerWithLogging);
  83. }
  84. else if (pressedKey.KeyChar == 'e')
  85. {
  86. Task.Run(new MessageThroughputTest().Run);
  87. }
  88. Thread.Sleep(Timeout.Infinite);
  89. }
  90. }
  91. }