public void GraphLists2() { Graph g = new Graph(); INode listRoot = this.TestListsBasic(g); //Try extending the list List <INode> items = Enumerable.Range(11, 10).Select(i => i.ToLiteral(g)).OfType <INode>().ToList(); g.AddToList(listRoot, items); TestTools.ShowGraph(g); Assert.AreEqual(items.Count * 4, g.Triples.Count, "Expected " + (items.Count * 4) + " Triples"); List <INode> listItems = g.GetListItems(listRoot).ToList(); Assert.AreEqual(items.Count * 2, listItems.Count, "Expected " + (items.Count * 2) + " Items in the List"); for (int i = 0; i < items.Count; i++) { Assert.AreEqual(items[i], listItems[i + 10], "Items were not in list in correct order"); } g.RetractList(listRoot); Assert.AreEqual(0, g.Triples.Count, "Should be no triples after the list is retracted"); }
public void GraphLists2() { Graph g = new Graph(); INode listRoot = this.TestListsBasic(g); //Try extending the list List <INode> items = Enumerable.Range(11, 10).Select(i => i.ToLiteral(g)).OfType <INode>().ToList(); g.AddToList(listRoot, items); TestTools.ShowGraph(g); Assert.Equal(items.Count * 4, g.Triples.Count); List <INode> listItems = g.GetListItems(listRoot).ToList(); Assert.Equal(items.Count * 2, listItems.Count); for (int i = 0; i < items.Count; i++) { Assert.Equal(items[i], listItems[i + 10]); } g.RetractList(listRoot); Assert.Equal(0, g.Triples.Count); }
public void GraphListsError4() { Graph g = new Graph(); g.AddToList <int>(g.CreateBlankNode(), Enumerable.Range(1, 10), i => i.ToLiteral(g)); }
public void GraphLists5() { Graph g = new Graph(); g.AddToList(g.CreateBlankNode(), Enumerable.Empty <INode>()); }
public void GraphListsError4() { Graph g = new Graph(); Assert.Throws <RdfException>(() => g.AddToList <int>(g.CreateBlankNode(), Enumerable.Range(1, 10), i => i.ToLiteral(g))); }