public void ForAnyInvocationOnDelegate() { var invocationMatcher = InvocationMatcher.ForAnyInvocationOn(myDelegate); Assert.IsNull(invocationMatcher.Method); Assert.IsNull(invocationMatcher.ParameterValueConstraints); Assert.AreEqual(myDelegate.Target + "(*)", invocationMatcher.ToString()); }
public void ForAnyInvocationOnTarget() { var invocationMatcher = InvocationMatcher.ForAnyInvocationOn(myObject); Assert.IsNull(invocationMatcher.Method); Assert.IsNull(invocationMatcher.ParameterValueConstraints); Assert.AreEqual(myObject + ".*", invocationMatcher.ToString()); }
public void MatchesAnyInvocationOnDelegate() { var target1 = myDelegate; var target2 = (MyDelegate) new MyObject().MethodWithReturnValue; var invocationMatcher = InvocationMatcher.ForAnyInvocationOn(target1); Assert.IsTrue(invocationMatcher.Matches(CreateMethodInvocation(target1.Target, myDelegate.Method.Name))); Assert.IsFalse(invocationMatcher.Matches(CreateMethodInvocation(target2.Target, myDelegate.Method.Name))); }
public void MatchesAnyInvocationOnDelegateDoesNotIncludesMethodsDeclaredOnObject() { var target = myDelegate; var objectMethodInvocation = new Invocation((IProxy)target.Target, typeof(object).GetMethod("ToString"), null, new object[0], null, 0); var invocationMatcher = InvocationMatcher.ForAnyInvocationOn(target); Assert.IsFalse(invocationMatcher.Matches(objectMethodInvocation)); }
public void MatchesAnyInvocationOnTarget() { var target1 = new MyObject(); var target2 = new MyObject(); var invocationMatcher = InvocationMatcher.ForAnyInvocationOn(target1); Assert.IsTrue(invocationMatcher.Matches(CreateMethodInvocation(target1, "Method"))); Assert.IsTrue(invocationMatcher.Matches(CreateMethodInvocation(target1, "MethodWithReturnValue"))); Assert.IsFalse(invocationMatcher.Matches(CreateMethodInvocation(target2, "MethodWithReturnValue"))); }
public ISpecifyActionForAny AnyInvocationOn(object target) { return(ActionInvoked(InvocationMatcher.ForAnyInvocationOn(target))); }