Пример #1
0
        public void All_Waits_Are_Cancelled_When_CancelAll_Is_Invoked()
        {
            var waiter    = new Waiter(0);
            var loginKey  = new WaitKey(MessageCode.ServerLogin, "1");
            var loginKey2 = new WaitKey(MessageCode.ServerLogin, "2");
            var leaveKey  = new WaitKey(MessageCode.ServerLeaveRoom);

            var loginTask  = waiter.Wait <object>(loginKey);
            var loginTask2 = waiter.Wait <object>(loginKey2);
            var leaveTask  = waiter.Wait <object>(leaveKey);

            waiter.CancelAll();

            Assert.True(loginTask.IsCanceled);
            Assert.True(loginTask2.IsCanceled);
            Assert.True(leaveTask.IsCanceled);
        }