Ejemplo n.º 1
0
        public static void FailingMatchOfParameterHavingAnOutAttribute(
            IHaveAnOutParameter subject,
            bool result)
        {
            "Given a fake"
            .x(() => subject = A.Fake <IHaveAnOutParameter>());

            "And a call to a method with a parameter having an out attribute is configured on this fake"
            .x(() => A.CallTo(() => subject.Validate("a constraint string")).Returns(true));

            "When I make a call to the configured method with a different string"
            .x(() => result = subject.Validate("a different string"));

            "Then it should return the default value"
            .x(() => result.Should().BeFalse());
        }
Ejemplo n.º 2
0
        public static void ParameterHavingAnOutAttribute(
            IHaveAnOutParameter subject)
        {
            "establish"
            .x(() => subject = A.Fake <IHaveAnOutParameter>());

            "when matching a call with a parameter having an out attribute"
            .x(() => A.CallTo(() => subject.Validate("a constraint string"))
               .Returns(true));

            "it should match when ref parameter value matches"
            .x(() => subject.Validate("a constraint string")
               .Should().BeTrue());

            "it should not match when ref parameter value does not match"
            .x(() => subject.Validate("a different string")
               .Should().BeFalse());
        }