コード例 #1
0
        public async Task TestWaitDisconnectEmpty()
        {
            var connections = new ConnectionsService();

            connections.ClientConnected();
            connections.ClientDisconnected();
            await connections.WaitDisconnectAll().ConfigureAwait(false);
        }
コード例 #2
0
        public async Task TestWaitDisconnect()
        {
            var connections = new ConnectionsService();

            connections.ClientConnected();
            connections.ClientConnected();
            connections.ClientDisconnected();
            connections.ClientDisconnected();
            connections.ClientConnected();
            bool empty = false;
            var  task  = connections.WaitDisconnectAll().ContinueWith(_ => Assert.IsTrue(empty), TaskScheduler.Default);

            connections.ClientDisconnected();
            empty = true;
            await task.ConfigureAwait(false);
        }