public void IEnumerableCountNamedGraphTest() { EntityGraph gr = a.EntityGraph(EntityGraphs.CircularGraphShape1); a.BSet.Add(new B()); Assert.IsTrue(gr.Count() == 4, "Graph contains unexpected number of elements"); }
public void FullEntityGraphShapeTestCollectionAssociations() { A a = new A { B = new B() }; a.B.Cs = new List <C>() { new C() }; var shape = new FullEntityGraphShape(); var outedges = shape.OutEdges(a.B); Assert.IsTrue(outedges.Count() == 2); var collection = outedges.Single(x => x.Name == "Cs"); Assert.IsTrue(collection == typeof(B).GetProperty("Cs")); var graph = new EntityGraph <object>(a, shape); Assert.IsTrue(graph.Count() == 3); }
public void IEnumerableNamedGraphTest() { B newB = new B(); a.BSet.Add(newB); EntityGraph eg = a.EntityGraph(EntityGraphs.CircularGraphShape1); Assert.AreEqual(a, eg.OfType <A>().Single()); Assert.AreEqual(b, eg.OfType <B>().Single()); Assert.AreEqual(c, eg.OfType <C>().Single()); Assert.AreEqual(d, eg.OfType <D>().Single()); Assert.IsTrue(eg.Count() == 4); }
public void IEnumerableTest() { B newB = new B(); a.BSet.Add(newB); EntityGraph eg = a.EntityGraph(EntityGraphs.CircularGraphFull); Assert.AreEqual(a, eg.OfType <A>().Single()); Assert.AreEqual(c, eg.OfType <C>().Single()); Assert.AreEqual(d, eg.OfType <D>().Single()); Assert.IsTrue(eg.OfType <B>().Contains(b)); Assert.IsTrue(eg.OfType <B>().Contains(newB)); Assert.IsTrue(eg.Count() == 5); }
public void FullEntityGraphShapeTestSingleAssociations() { A a = new A { B = new B() }; var shape = new FullEntityGraphShape(); var outedges = shape.OutEdges(a); Assert.IsTrue(outedges.Count() == 1); Assert.IsTrue(outedges.Single() == typeof(A).GetProperty("B")); var graph = new EntityGraph <object>(a, shape); Assert.IsTrue(graph.Count() == 2); }
public void CloneIntoPreservesAllEntityStates() { EntityGraphTestsDomainContext ctx = new EntityGraphTestsDomainContext(); EntityGraphTestsDomainContext ctxNew = new EntityGraphTestsDomainContext(); ctx.As.Add(a); var gr = new EntityGraph(a, new FullEntityGraphShape()); var clone = gr.Clone(ctxNew); var result = from source in gr from cloned in clone where source.GetType() == cloned.GetType() where source.EntityState == cloned.EntityState select cloned; Assert.IsTrue(result.Count() == gr.Count()); }
public void FullEntityGraphShapeTestCycle() { A a = new A { B = new B() }; a.B.Cs = new List <C>() { new C { A = a } }; var shape = new FullEntityGraphShape(); var graph = new EntityGraph <object>(a, shape); Assert.IsTrue(graph.Count() == 3); }