コード例 #1
0
 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);
 }
コード例 #2
0
        /// <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));
        }
コード例 #3
0
		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))
				);
		}
コード例 #4
0
 public void ExceptionWhenArgsDontMatch()
 {
     callback = new CallbackExpectation(new FakeInvocation(method), new DelegateDefinations.NoArgsDelegate(VoidNoArgs), new Range(1, 1));
 }
コード例 #5
0
 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);
 }
コード例 #6
0
 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);
 }
コード例 #7
0
 public void CallBackWithDifferentSignature()
 {
     callback = new CallbackExpectation(new FakeInvocation(method), new DelegateDefinations.IntArgDelegate(OneArg), new Range(1, 1));
 }
コード例 #8
0
 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);
 }
コード例 #9
0
 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;
 }
コード例 #10
0
 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);
 }
コード例 #11
0
		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)));
		}