コード例 #1
0
        public void ToStringContainsFieldComparisonAndValue()
        {
            var criteria = new MissingCriteria("thisIsAMissingField");
            var result = criteria.ToString();

            Assert.Contains(criteria.Field, result);
        }
コード例 #2
0
        public void ConstructorSetsCriteria()
        {
            const string field = "myField";

            var criteria = new MissingCriteria(field);

            Assert.Equal(field, criteria.Field);
        }
コード例 #3
0
        public void NamePropertyIsMissing()
        {
            var criteria = new MissingCriteria("something");

            Assert.Equal("missing", criteria.Name);
        }
コード例 #4
0
        public void BodyContainsFilterMissing()
        {
            const string expectedFieldName = "fieldShouldBeMissing";
            var termCriteria = new MissingCriteria(expectedFieldName);

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

            var field = body.TraverseWithAssert("query", "filtered", "filter", "missing", "field");
            Assert.Equal(expectedFieldName, field);
        }