public void ToStringContainsFieldAndRegex()
        {
            var criteria = new RegexpCriteria("field", "regexp");
            var result = criteria.ToString();

            Assert.Contains(criteria.Field, result);
            Assert.Contains(criteria.Regexp, result);
        }
        public void ConstructorSetsProperties()
        {
            const string expectedField = "someField";
            const string expectedRegexp = "someRegexp";

            var criteria = new RegexpCriteria(expectedField, expectedRegexp);
            
            Assert.Equal(expectedField, criteria.Field);
            Assert.Equal(expectedRegexp, criteria.Regexp);
        }
 static JObject Build(RegexpCriteria criteria)
 {
     return new JObject(new JProperty(criteria.Name, new JObject(new JProperty(criteria.Field, criteria.Regexp))));
 }
        public void BodyContainsRegexFilter()
        {
            const string expectedField = "motor";
            const string expectedRegexp = "SR20DET";
            var regexpCriteria = new RegexpCriteria(expectedField, expectedRegexp);

            var formatter = new SearchRequestFormatter(defaultConnection, mapping, new SearchRequest { DocumentType = "type1", Filter = regexpCriteria });
            var body = JObject.Parse(formatter.Body);

            var actualRegexp = body.TraverseWithAssert("query", "filtered", "filter", "regexp", expectedField);
            Assert.Equal(expectedRegexp, actualRegexp);
        }
        public void NamePropertyIsRegexp()
        {
            var criteria = new RegexpCriteria("field", "regexp");

            Assert.Equal("regexp", criteria.Name);
        }