コード例 #1
0
        public void ResultStillCompletes()
        {
            var sut = new ContinueResultDecorator(_inner, () => TestHelper.EmptyCoroutine);

            var args = sut.BlockingExecute();

            Assert.IsFalse(args.WasCancelled);
        }
コード例 #2
0
        public void ResultStillFailsWithSameError()
        {
            var sut = new ContinueResultDecorator(_inner, () => TestHelper.EmptyCoroutine);

            var args = sut.BlockingExecute();

            Assert.AreSame(_innerError, args.Error);
        }
コード例 #3
0
        public void ResultStillCompletes()
        {
            var sut = new ContinueResultDecorator(_inner, () => TestHelper.EmptyCoroutine);

            var args = sut.BlockingExecute();

            Assert.IsFalse(args.WasCancelled);
        }
コード例 #4
0
        public void ResultStillFailsWithSameError()
        {
            var sut = new ContinueResultDecorator(_inner, () => TestHelper.EmptyCoroutine);

            var args = sut.BlockingExecute();

            Assert.AreSame(_innerError, args.Error);
        }
コード例 #5
0
        public void DecoratorFailsWhenCoroutineFails()
        {
            var error         = new Exception();
            var failingResult = TestHelper.MockResult(false, error).Object;

            var sut = new ContinueResultDecorator(_inner, failingResult.AsCoroutine);

            var args = sut.BlockingExecute();

            Assert.AreSame(args.Error, error);
        }
コード例 #6
0
        public void DecoratorFailsWhenCoroutineFails()
        {
            var error = new Exception();
            var failingResult = TestHelper.MockResult(false, error).Object;

            var sut = new ContinueResultDecorator(_inner, failingResult.AsCoroutine);

            var args = sut.BlockingExecute();

            Assert.AreSame(args.Error, error);
        }
コード例 #7
0
        public void CoroutineIsExecuted()
        {
            bool coroutineExecuted = false;
            var coroutineMock = new Mock<IEnumerable<IResult>>();
            coroutineMock.Setup(x => x.GetEnumerator())
                .Callback(() => coroutineExecuted = true);

            var sut = new ContinueResultDecorator(_inner, () => coroutineMock.Object);

            sut.BlockingExecute();

            Assert.IsFalse(coroutineExecuted);
        }
コード例 #8
0
        public void CoroutineDoesNotGetExecuted()
        {
            bool coroutineExecuted = false;
            var coroutineMock = new Mock<IResult>();
            coroutineMock.Setup(x => x.Execute(It.IsAny<ActionExecutionContext>()))
                .Callback(() => coroutineExecuted = true);

            var sut = new ContinueResultDecorator(_inner, () => coroutineMock.Object.AsCoroutine());

            sut.BlockingExecute();

            Assert.IsFalse(coroutineExecuted);
        }
コード例 #9
0
        public void CoroutineIsExecuted()
        {
            bool coroutineExecuted = false;
            var  coroutineMock     = new Mock <IEnumerable <IResult> >();

            coroutineMock.Setup(x => x.GetEnumerator())
            .Callback(() => coroutineExecuted = true);

            var sut = new ContinueResultDecorator(_inner, () => coroutineMock.Object);

            sut.BlockingExecute();

            Assert.IsFalse(coroutineExecuted);
        }
コード例 #10
0
        public void CoroutineDoesNotGetExecuted()
        {
            bool coroutineExecuted = false;
            var  coroutineMock     = new Mock <IResult>();

            coroutineMock.Setup(x => x.Execute(It.IsAny <ActionExecutionContext>()))
            .Callback(() => coroutineExecuted = true);

            var sut = new ContinueResultDecorator(_inner, () => coroutineMock.Object.AsCoroutine());

            sut.BlockingExecute();

            Assert.IsFalse(coroutineExecuted);
        }
コード例 #11
0
        public void CoroutineUsesSameContextAsInner()
        {
            var context = new ActionExecutionContext();
            var resultMock = new Mock<IResult>();
            resultMock.Setup(x => x.Execute(context))
                .Raises(x => x.Completed += null, new ResultCompletionEventArgs())
                .Verifiable("wrong context");

            var sut = new ContinueResultDecorator(_inner, resultMock.Object.AsCoroutine);

            sut.BlockingExecute(context);

            resultMock.Verify();
        }
コード例 #12
0
        public void CoroutineUsesSameContextAsInner()
        {
            var context    = new ActionExecutionContext();
            var resultMock = new Mock <IResult>();

            resultMock.Setup(x => x.Execute(context))
            .Raises(x => x.Completed += null, new ResultCompletionEventArgs())
            .Verifiable("wrong context");

            var sut = new ContinueResultDecorator(_inner, resultMock.Object.AsCoroutine);

            sut.BlockingExecute(context);

            resultMock.Verify();
        }
コード例 #13
0
        public void CoroutineGetsExecuted()
        {
            bool coroutineExecuted = false;
            var  resultMock        = new Mock <IResult>();

            resultMock.Setup(x => x.Execute(It.IsAny <ActionExecutionContext>()))
            .Raises(x => x.Completed += null, () =>
            {
                coroutineExecuted = true;
                return(new ResultCompletionEventArgs());
            });

            var sut = new ContinueResultDecorator(_inner, resultMock.Object.AsCoroutine);

            sut.BlockingExecute();

            Assert.IsTrue(coroutineExecuted);
        }
コード例 #14
0
        public void CoroutineGetsExecuted()
        {
            bool coroutineExecuted = false;
            var resultMock = new Mock<IResult>();

            resultMock.Setup(x => x.Execute(It.IsAny<ActionExecutionContext>()))
                .Raises(x => x.Completed += null, () =>
                                                      {
                                                          coroutineExecuted = true;
                                                          return new ResultCompletionEventArgs();
                                                      });

            var sut = new ContinueResultDecorator(_inner, resultMock.Object.AsCoroutine);

            sut.BlockingExecute();

            Assert.IsTrue(coroutineExecuted);
        }