Esempio n. 1
0
        public void WhenEventIsDefault_ItShouldBeNonSignaled()
        {
            var sut = new AsyncManualResetEvent();

            ConcurrentAssert.EnsureThatTaskIsNeverCompleted(sut.WaitAsync());
            ConcurrentAssert.EnsureThatTaskIsNeverCompleted(sut.WaitAsync());
            ConcurrentAssert.EnsureThatActionIsNeverCompleted(sut.Wait);
            ConcurrentAssert.EnsureThatActionIsNeverCompleted(sut.Wait);
        }
        public void WhenEventIsSignaled_ItShouldNotMakeWaitedOnlySingleClient()
        {
            var sut = new AsyncAutoResetEvent();

            sut.Set();

            ConcurrentAssert.EnsureThatActionIsCompleted(sut.Wait);
            ConcurrentAssert.EnsureThatActionIsNeverCompleted(sut.Wait);
        }
Esempio n. 3
0
        public void WhenEventIsReset_ItShouldMakeClientsWaited()
        {
            var sut = new AsyncManualResetEvent();

            sut.Set();

            ConcurrentAssert.EnsureThatActionIsCompleted(sut.Wait);
            ConcurrentAssert.EnsureThatActionIsCompleted(sut.Wait);

            sut.Reset();

            ConcurrentAssert.EnsureThatActionIsNeverCompleted(sut.Wait);
            ConcurrentAssert.EnsureThatActionIsNeverCompleted(sut.Wait);
        }