Esempio n. 1
0
 static void Main()
 {
     var testCancellation = new TestCancellation();
     testCancellation.TestCancellationToken();
     testCancellation.TestCancelCallback();
     testCancellation.TestCancelPrerequisites();
 }
Esempio n. 2
0
        static void Main()
        {
            var testCancellation = new TestCancellation();

            testCancellation.TestCancellationToken();
            testCancellation.TestCancelCallback();
            testCancellation.TestCancelPrerequisites();
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WebSocketTestBase"/> class.
        ///     Create a new <see cref="WebSocketTestBase"/>.
        /// </summary>
        /// <param name="testOutput">
        ///     Output for the current test.
        /// </param>
        protected WebSocketTestBase(ITestOutputHelper testOutput)
        {
            this.testOutput = testOutput;

            int port = Interlocked.Increment(ref nextPort);

            // Useful to diagnose test timeouts.
            TestCancellation.Register(
                () => testOutput.WriteLine("Test-level cancellation token has been canceled."));

            ServerBaseAddress    = new Uri($"http://localhost:{port}");
            WebSocketBaseAddress = new Uri($"ws://localhost:{port}");

            Host = WebHost.CreateDefaultBuilder()
                   .UseStartup <Startup>()
                   .ConfigureServices(ConfigureTestServerServices)
                   .ConfigureLogging(ConfigureTestServerLogging)
                   .UseUrls(ServerBaseAddress.AbsoluteUri)
                   .Build();
        }