public void CanVerifyWhenIsBoundToInstanceMethodsOnAnotherObject()
 {
     var other = new SimpleCommandCanBeVerifiedWithoutCallingIt();
     _testSubject = new SimpleCommand(other._CorrectCanExecuteInstanceMethod, other._CorrectExecuteInstanceMethod);
     Assert.That(_testSubject.MethodHandlingCanExecute, Calls.To(() => other._CorrectCanExecuteInstanceMethod()));
     Assert.That(_testSubject.MethodHandlingExecute, Calls.To(() => other._CorrectExecuteInstanceMethod()));
 }
 public void ShouldFireAssertionWhenBindingIsNotAsExpected()
 {
     var other = new SimpleCommandCanBeVerifiedWithoutCallingIt();
     _testSubject = new SimpleCommand(_CorrectCanExecuteInstanceMethod, other._CorrectExecuteInstanceMethod);
     var actualBinding = Extract.BindingInfoFrom(() => other._CorrectExecuteInstanceMethod()).ToString();
     _AssertionShouldFail(() => _CorrectExecuteStaticMethod(), "bound to incorrect method", actualBinding);
     _AssertionShouldFail(() => _CorrectExecuteInstanceMethod(), "bound to incorrect object instance", actualBinding);
 }
コード例 #3
0
        public void CanVerifyWhenIsBoundToInstanceMethodsOnAnotherObject()
        {
            var other = new SimpleCommandCanBeVerifiedWithoutCallingIt();

            _testSubject = new SimpleCommand(other._CorrectCanExecuteInstanceMethod, other._CorrectExecuteInstanceMethod);
            Assert.That(_testSubject.MethodHandlingCanExecute, Calls.To(() => other._CorrectCanExecuteInstanceMethod()));
            Assert.That(_testSubject.MethodHandlingExecute, Calls.To(() => other._CorrectExecuteInstanceMethod()));
        }
コード例 #4
0
        public void ShouldFireAssertionWhenBindingIsNotAsExpected()
        {
            var other = new SimpleCommandCanBeVerifiedWithoutCallingIt();

            _testSubject = new SimpleCommand(_CorrectCanExecuteInstanceMethod, other._CorrectExecuteInstanceMethod);
            var actualBinding = Extract.BindingInfoFrom(() => other._CorrectExecuteInstanceMethod()).ToString();

            _AssertionShouldFail(() => _CorrectExecuteStaticMethod(), "bound to incorrect method", actualBinding);
            _AssertionShouldFail(() => _CorrectExecuteInstanceMethod(), "bound to incorrect object instance", actualBinding);
        }