示例#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);
 }
示例#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));
		}