public void TryingToPassNullToReturnOrThrowWithActionWillThrow() { AnyArgsExpectation expectation = new AnyArgsExpectation(new FakeInvocation(typeof(object).GetMethod("ToString")), new Range(1, 1)); expectation.ActionToExecute = (ToStringDelegate)delegate { return "fpp"; }; expectation.ReturnOrThrow(null,null); }
public void TryingToPassNullToReturnOrThrowWithActionWillThrow() { AnyArgsExpectation expectation = new AnyArgsExpectation(new FakeInvocation(typeof(object).GetMethod("ToString")), new Range(1, 1)); expectation.ActionToExecute = (ToStringDelegate)delegate { return "fpp"; }; Assert.Throws<InvalidOperationException>( "Trying to run a Do() delegate when no arguments were matched to the expectation.", () => expectation.ReturnOrThrow(null, null)); }