Beispiel #1
0
        public void Constructor_SetsCaseSensitivity()
        {
            var fields    = new TestPredicateFields();
            var predicate = new EndsWithPredicate <TestPredicateFields>(fields, true, null, null);

            Assert.IsTrue(predicate.IsCaseSensitive);
        }
Beispiel #2
0
        public async Task AndPredicateExample()
        {
            var imposter = _client.CreateTcpImposter(4554, "AndPredicateExample");

            var startsWithFields = new TcpPredicateFields {
                Data = "start"
            };
            var startsWith = new StartsWithPredicate <TcpPredicateFields>(startsWithFields);

            var endsWithFields = new TcpPredicateFields {
                Data = "end\n"
            };
            var endsWith = new EndsWithPredicate <TcpPredicateFields>(endsWithFields);

            var containsFields = new TcpPredicateFields {
                Data = "middle"
            };
            var contains = new ContainsPredicate <TcpPredicateFields>(containsFields);

            var predicate = new AndPredicate(new List <PredicateBase> {
                startsWith, endsWith, contains
            });

            imposter.AddStub().On(predicate)
            .ReturnsData("matches");

            await _client.SubmitAsync(imposter);
        }
Beispiel #3
0
        public void Constructor_SetsFieldObject()
        {
            var expectedFields = new TestPredicateFields();
            var predicate      = new EndsWithPredicate <TestPredicateFields>(expectedFields);

            Assert.AreSame(expectedFields, predicate.Fields);
        }
Beispiel #4
0
        public void EndsWithPredicate(SqlFragment parent, EndsWithPredicate endsWithPredicate)
        {
            endsWithPredicate.LeftOperand.Build(parent, this);
            this.Script.Append("LIKE");
            Expression expression = "%" + endsWithPredicate.RightOperand;

            expression.Build(parent, this);
        }
        public void Constructor_SetsXpathSelector()
        {
            var expectedXPathSelector = new XPathSelector("!$");

            var fields = new TestPredicateFields();
            var predicate = new EndsWithPredicate<TestPredicateFields>(fields, false, null, expectedXPathSelector);
            Assert.AreEqual(expectedXPathSelector, predicate.Selector);
        }
        public void Constructor_SetsExceptExpression()
        {
            const string expectedExceptRegex = "!$";

            var fields = new TestPredicateFields();
            var predicate = new EndsWithPredicate<TestPredicateFields>(fields, false, expectedExceptRegex, null);
            Assert.AreEqual(expectedExceptRegex, predicate.ExceptExpression);
        }
Beispiel #7
0
        public void Constructor_SetsXpathSelector()
        {
            var expectedXPathSelector = new XPathSelector("!$");

            var fields    = new TestPredicateFields();
            var predicate = new EndsWithPredicate <TestPredicateFields>(fields, false, null, expectedXPathSelector);

            Assert.AreEqual(expectedXPathSelector, predicate.Selector);
        }
Beispiel #8
0
        public void Constructor_SetsExceptExpression()
        {
            const string expectedExceptRegex = "!$";

            var fields    = new TestPredicateFields();
            var predicate = new EndsWithPredicate <TestPredicateFields>(fields, false, expectedExceptRegex, null);

            Assert.AreEqual(expectedExceptRegex, predicate.ExceptExpression);
        }
        public void EndsWithPredicate_Constructor_SetsJsonPathSelector()
        {
            var expectedJsonPathSelector = new JsonPathSelector("$..title");

            var fields    = new TestPredicateFields();
            var predicate = new EndsWithPredicate <TestPredicateFields>(fields, jsonpath: expectedJsonPathSelector);

            Assert.AreEqual(expectedJsonPathSelector, predicate.JsonPathSelector);
        }
 public void Constructor_SetsFieldObject()
 {
     var expectedFields = new TestPredicateFields();
     var predicate = new EndsWithPredicate<TestPredicateFields>(expectedFields);
     Assert.AreSame(expectedFields, predicate.Fields);
 }
 public void Constructor_SetsCaseSensitivity()
 {
     var fields = new TestPredicateFields();
     var predicate = new EndsWithPredicate<TestPredicateFields>(fields, true, null, null);
     Assert.IsTrue(predicate.IsCaseSensitive);
 }