Example #1
0
 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);
 }
Example #2
0
		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));
		}