Ejemplo n.º 1
0
 public IEnumerator AcceptTransport2() => RunAsync(async() =>
 {
     transport2.AcceptAsync().Returns(Task.FromResult(conn1));
     // transport1 task never ends
     transport1.AcceptAsync().Returns(new TaskCompletionSource <IConnection>().Task);
     Assert.That(await transport.AcceptAsync(), Is.SameAs(conn1));
 });
        private async Task AcceptLoopAsync()
        {
            while (true)
            {
                var connection = await _transport.AcceptAsync();

                if (connection == null)
                {
                    break;
                }

                _ = OnConnection(connection);
            }
        }
Ejemplo n.º 3
0
 public IEnumerator AcceptTransport2() => RunAsync(async() =>
 {
     transport1.Supported.Returns(false);
     transport2.AcceptAsync().Returns(Task.FromResult(conn1));
     Assert.That(await transport.AcceptAsync(), Is.SameAs(conn1));
 });