Beispiel #1
0
        public void Match_WhenFirstValueIsNotContext_ThrowsInvalidOperationException(ContextControlStringMatcher unit)
        {
            unit.Context = "foo";

            var fixture = new Fixture();

            fixture.Customizations.Add(new InlineConstructorParams <ControlString>(0, 3, new Queue <string>(new[] { "bar" })));

            var controlString = fixture.Create <ControlString>();

            Should.Throw <ArgumentException>(() => unit.Match(controlString));
        }
Beispiel #2
0
        public void Match_WhenFirstValueIsContext_ExecutesSecondControlStringMatcher([Frozen] IControlStringMatcher submatcher, ContextControlStringMatcher unit)
        {
            Mock.Get(submatcher).Setup(x => x.Matches(It.IsAny <ControlString>())).Returns(true);

            unit.Context = "foo";

            var expected = "bar";

            var fixture = new Fixture();

            fixture.Customizations.Add(new InlineConstructorParams <ControlString>(0, 3, new Queue <string>(new[] { unit.Context, expected })));

            var controlString = fixture.Create <ControlString>();

            unit.Match(controlString);

            Mock.Get(unit.Matcher).Verify(x => x.Match(It.Is <ControlString>(y => y.Values.Peek() == expected)));
        }
Beispiel #3
0
 public void Match_WhenControlStringIsNull_ThrowsArgumentNullException(ContextControlStringMatcher unit)
 {
     Should.Throw <ArgumentNullException>(() => unit.Match(null));
 }