Exemplo n.º 1
0
        public void Should_CallAbort_When_Dispose()
        {
            WuStateAsyncJobProxy state = new WuStateAsyncJobProxy(WuStateId.Downloading, "name", 0);

            state.Dispose();
            Assert.IsTrue(state.AbortCalled);
        }
Exemplo n.º 2
0
        public void Should_NotAllowReEnter_When_WuStateAsyncJobIsDisposed()
        {
            WuStateAsyncJob state = new WuStateAsyncJobProxy(WuStateId.Downloading, "name", 1);

            state.Dispose();
            state.EnterState(new WuStateReady());
        }
Exemplo n.º 3
0
        public void Should_ReturnTrue_When_CallIsDisposedAfterDispose()
        {
            WuStateAsyncJob state = new WuStateAsyncJobProxy(WuStateId.Downloading, "name", 0);

            Assert.IsFalse(state.IsDisposed);
            state.Dispose();
            Assert.IsTrue(state.IsDisposed);
        }
Exemplo n.º 4
0
        public void Should_CallOnTimeout_When_TimeRunsOut()
        {
            int timeout = 1;
            WuStateAsyncJobProxy state = new WuStateAsyncJobProxy(WuStateId.Downloading, "name", timeout);

            state.EnterState(new WuStateReady());

            if (!state.OnTimeoutSignal.WaitOne((int)(timeout * 1000 * 1.5)))
            {
                Assert.Fail($"OnTimeout was not called");
            }
            Assert.IsFalse(state.IsRunning);
            state.Dispose();
        }