public void CallBackWithDifferentSignature() { var ex = Assert.Throws<InvalidOperationException>(() => this.callback = new CallbackExpectation( new FakeInvocation(this.method), new DelegateDefinations.IntArgDelegate(this.OneArg), new Range(1, 1))); Assert.Equal("Callback arguments didn't match the method arguments", ex.Message); }
/// <summary> /// Determines if the object equal to expectation /// </summary> public override bool Equals(object obj) { CallbackExpectation other = obj as CallbackExpectation; if (other == null) { return(false); } return(Method.Equals(other.Method) && callback.Equals(other.callback)); }
public void ExceptionWhenArgsDontMatch() { Assert.Throws<InvalidOperationException>("Callback arguments didn't match the method arguments", () => callback = new CallbackExpectation(new FakeInvocation(method), new DelegateDefinations.NoArgsDelegate(VoidNoArgs), new Range(1, 1)) ); }
public void ExceptionWhenArgsDontMatch() { callback = new CallbackExpectation(new FakeInvocation(method), new DelegateDefinations.NoArgsDelegate(VoidNoArgs), new Range(1, 1)); }
public void CallMethodWhenTestIsExpected() { callback = new CallbackExpectation(new FakeInvocation(method), new DelegateDefinations.ThreeArgsDelegate(ThreeArgsDelegateMethod), new Range(1, 1)); callback.IsExpected(new object[] {1, "", 3.3f}); Assert.IsTrue(callbackCalled); }
public void CallbackWithDifferentSignature_NumArgsDifferent() { callback = new CallbackExpectation(new FakeInvocation(method), new DelegateDefinations.StringDelegate("".StartsWith), new Range(1, 1)); callback.IsExpected(new object[] {1, "", 3.3f}); Assert.IsTrue(callbackCalled); }
public void CallBackWithDifferentSignature() { callback = new CallbackExpectation(new FakeInvocation(method), new DelegateDefinations.IntArgDelegate(OneArg), new Range(1, 1)); }
public void CallbackDoesntReturnBool() { callback = new CallbackExpectation(new FakeInvocation(method), new DelegateDefinations.VoidThreeArgsDelegate(VoidThreeArgsDelegateMethod), new Range(1, 1)); callback.IsExpected(new object[] {1, "", 3.3f}); Assert.IsTrue(callbackCalled); }
protected override IExpectation GetExpectation(MethodInfo m, Range r, int actual) { CallbackExpectation expectation = new CallbackExpectation(new FakeInvocation(m), new DelegateDefinations.NoArgsDelegate(VoidNoArgs), new Range(1, 1)); SetupExpectation(expectation, r, actual); return expectation; }
public void ExceptionWhenArgsDontMatch() { var ex = Assert.Throws<InvalidOperationException>(() => this.callback = new CallbackExpectation(new FakeInvocation(this.method), new DelegateDefinations.NoArgsDelegate(this.VoidNoArgs), new Range(1, 1))); Assert.Equal("Callback arguments didn't match the method arguments", ex.Message); }
public void CallBackWithDifferentSignature() { Assert.Throws<InvalidOperationException>( "Callback arguments didn't match the method arguments", () => callback = new CallbackExpectation( new FakeInvocation(method), new DelegateDefinations.IntArgDelegate(OneArg), new Range(1, 1))); }