예제 #1
0
 public IEnumerable<IndexEntry> Index(Document document)
 {
     return IndexParser.GetEqExpressions(_indexText)
         .Select(eqExpression => document.FindValues(eqExpression.Item1.FullPath).Cast<Tuple<string,object>>().Select(t => t.Item1 + "=" + t.Item2))
         .CartesianProduct()
         .Select(combination => new IndexEntry(combination));
 }
예제 #2
0
 public void FindValues_WithThreePartPath_ShouldReturnAttributeValue()
 {
     var target = new Document();
     object expected = new Tuple<string,object>("foo/bar/quux","baz");
     target.GetSubDocument("foo").GetSubDocument("bar").SetAttribute("quux", "baz");
     var actual = target.FindValues("foo/bar/quux").Single();
     Assert.AreEqual(expected, actual, "GetAttributeReturnedDifferentValueFromSet");
 }
예제 #3
0
 public void FindValues_WithTwoPartPath_ShouldReturnSubDocumentAttributeValue()
 {
     var target = new Document();
     const string value = "bar";
     object expected = new Tuple<string,object>("foo/foo","bar");
     target.GetSubDocument("foo").SetAttribute("foo", value);
     var actual = target.FindValues("foo/foo").Single();
     Assert.AreEqual(expected, actual, "GetAttributeReturnedDifferentValueFromSet");
 }
예제 #4
0
 public void FindValues_WithAttributeName_ShouldReturnAttributeValue()
 {
     var target = new Document();
     const string name = "foo";
     const string value = "bar";
     object expected = new Tuple<string,object>(name,value);
     target.SetAttribute(name, value);
     var actual = target.FindValues(name).Single();
     Assert.AreEqual(expected, actual, "GetAttributeReturnedDifferentValueFromSet");
 }