public void ResultStillCompletes() { var sut = new ContinueResultDecorator(_inner, () => TestHelper.EmptyCoroutine); var args = sut.BlockingExecute(); Assert.IsFalse(args.WasCancelled); }
public void ResultStillFailsWithSameError() { var sut = new ContinueResultDecorator(_inner, () => TestHelper.EmptyCoroutine); var args = sut.BlockingExecute(); Assert.AreSame(_innerError, args.Error); }
public void ResultStillCompletes() { var sut = new ContinueResultDecorator(_inner, () => TestHelper.EmptyCoroutine); var args = sut.BlockingExecute(); Assert.IsFalse(args.WasCancelled); }
public void ResultStillFailsWithSameError() { var sut = new ContinueResultDecorator(_inner, () => TestHelper.EmptyCoroutine); var args = sut.BlockingExecute(); Assert.AreSame(_innerError, args.Error); }
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); }
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); }
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); }
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); }
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); }
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); }
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(); }
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(); }
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); }
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); }