コード例 #1
0
        public void IndexerSingleAttributeAndListTest()
        {
            // Arrange
            const string indexText = "LastName eq '?' and Addresses/Postcode eq '?'";
            var          document  = Document.Parse(@"{""FirstName"":""Bob"",""LastName"":""Smith"",
""Addresses"":[{""Postcode"":""P1""},{""Postcode"":""P2""}]
}");

            // Act
            var entries = new Indexer(indexText).Index(document);

            // Assert
            Assert.AreEqual(2, entries.Count());
            Assert.AreEqual(1, entries.Count(e => e.EqualityPart[0] == "LastName=Smith" && e.EqualityPart[1] == "Addresses/Postcode=P1"));
            Assert.AreEqual(1, entries.Count(e => e.EqualityPart[0] == "LastName=Smith" && e.EqualityPart[1] == "Addresses/Postcode=P2"));
        }
コード例 #2
0
        public void IndexerSingleAttributeSingleExpressionTest()
        {
            // Arrange
            const string indexText = "Name eq '?'";
            var          document  = Document.Parse(@"{""Name"":""Bob""}");

            // Act
            var entries = new Indexer(indexText).Index(document);

            // Assert
            Assert.AreEqual(1, entries.Count());
            var entry = entries.First();

            Assert.AreEqual("Name=Bob", entry.EqualityPart[0]);
        }