public void DoesNotMatchAndDoesNotThrowExceptionIfValueSpecifiedForOutputParameter()
        {
            Matcher matcher = new ArgumentsMatcher(Is.Same(arg1Value), Is.Same(arg2Value));

            var invocation = new Invocation(
                new NamedObject("receiver"),
                new MethodInfoStub("method",
                                   new ParameterInfoStub("in", ParameterAttributes.In),
                                   new ParameterInfoStub("out", ParameterAttributes.Out)),
                new[] {arg1Value, null});

            Assert.IsFalse(matcher.Matches(invocation));
        }
        public void DoesNotMatchIfValueMatchersDoNotMatchArgumentValues()
        {
            Matcher matcher = new ArgumentsMatcher(Is.Same(arg1Value), Is.Same(arg2Value));

            Assert.IsFalse(matcher.Matches(InvocationWithArguments("other object", arg2Value)),
                           "different first arg");
            Assert.IsFalse(matcher.Matches(InvocationWithArguments(arg1Value, "other object")),
                           "different second arg");
        }
 public void DoesNotMatchAnObjectThatIsNotAnInvocation()
 {
     Matcher matcher = new ArgumentsMatcher();
     Assert.IsFalse(matcher.Matches("not an invocation"));
 }
        public void ShowsOutputParametersInDescription()
        {
            Matcher matcher = new ArgumentsMatcher(new AlwaysMatcher(true, "arg1"), Is.Out);

            AssertDescription.IsEqual(matcher, "(arg1, out)");
        }
        public void MatchesOutputParametersWithSpecialMatcherClass()
        {
            Matcher matcher = new ArgumentsMatcher(Is.Same(arg1Value), Is.Out);

            var invocation = new Invocation(
                new NamedObject("receiver"),
                new MethodInfoStub("method",
                                   new ParameterInfoStub("in", ParameterAttributes.In),
                                   new ParameterInfoStub("out", ParameterAttributes.Out)),
                new[] {arg1Value, null});

            Assert.IsTrue(matcher.Matches(invocation));
        }
        public void MatchesInvocationWithSameNumberOfArgumentsAsMatcherHasValueMatchersAndValueMatchersMatch()
        {
            Matcher matcher = new ArgumentsMatcher(Is.Same(arg1Value), Is.Same(arg2Value));

            Assert.IsTrue(matcher.Matches(InvocationWithArguments(arg1Value, arg2Value)));
        }
        public void FormatsDescriptionToLookSimilarToAnArgumentList()
        {
            Matcher matcher = new ArgumentsMatcher(
                new AlwaysMatcher(true, "arg1-description"),
                new AlwaysMatcher(true, "arg2-description"));

            AssertDescription.IsEqual(matcher, "(arg1-description, arg2-description)");
        }
        public void DoesNotMatchInvocationWithDifferentNumberOfArguments()
        {
            Matcher matcher = new ArgumentsMatcher(Is.Anything, Is.Anything);

            Assert.IsFalse(matcher.Matches(InvocationWithArguments(1)), "fewer arguments");
            Assert.IsFalse(matcher.Matches(InvocationWithArguments(1, 2, 3)), "more arguments");
        }