private static BuildableExpectation BuildExpectation( string expectationDescription, string matchRequiredCallCountDescription, string matchMatchingCallCountDescription, IMockObject receiver, string matchMethodDescription, string matchArgumentsDescription, params string[] extraMatcherDescriptions) { var extraMatchers = new Matcher[extraMatcherDescriptions.Length]; for (int i = 0; i < extraMatchers.Length; i++) { extraMatchers[i] = new AlwaysMatcher(true, extraMatcherDescriptions[i]); } return(BuildExpectation( expectationDescription, new AlwaysMatcher(true, matchRequiredCallCountDescription), new AlwaysMatcher(true, matchMatchingCallCountDescription), receiver, new AlwaysMatcher(true, matchMethodDescription), new AlwaysMatcher(true, matchArgumentsDescription), extraMatchers)); }
public void AlwaysReturnsFixedBooleanValueFromMatchesMethod() { Matcher matcher = new AlwaysMatcher(true, ""); Assert.IsTrue(matcher.Matches("something")); Assert.IsTrue(matcher.Matches("something else")); Assert.IsTrue(matcher.Matches(null)); Assert.IsTrue(matcher.Matches(1)); Assert.IsTrue(matcher.Matches(1.0)); Assert.IsTrue(matcher.Matches(new object())); matcher = new AlwaysMatcher(false, ""); Assert.IsFalse(matcher.Matches("something")); Assert.IsFalse(matcher.Matches("something else")); Assert.IsFalse(matcher.Matches(null)); Assert.IsFalse(matcher.Matches(1)); Assert.IsFalse(matcher.Matches(1.0)); Assert.IsFalse(matcher.Matches(new object())); }
private static object BuildExpectation( bool matchRequiredCallCount, bool matchMatchingCallCount, IMockObject receiver, bool matchMethod, bool matchArguments, params bool[] matchExtraMatchers) { Matcher[] extraMatchers = new Matcher[matchExtraMatchers.Length]; for (int i = 0; i < extraMatchers.Length; i++) { extraMatchers[i] = new AlwaysMatcher(matchExtraMatchers[i], "extra matcher " + (i + 1)); } return(BuildExpectation( "description", new AlwaysMatcher(matchRequiredCallCount, "required call count"), new AlwaysMatcher(matchMatchingCallCount, "matching call count"), receiver, new AlwaysMatcher(matchMethod, "method"), new AlwaysMatcher(matchArguments, "argument"), extraMatchers)); }