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); }