public void TestAssociation_OneToOne() { ScenariosEntityTestContainer ec = new ScenariosEntityTestContainer(); // set up association, C pointing to D D d1 = new D { ID = 1 }; C c1 = new C { ID = 1, DID_Ref1 = 1 }; ec.GetEntitySet <D>().Attach(d1); ec.GetEntitySet <C>().Attach(c1); // now point another C at the above D that is already // part of an association C c2 = new C { ID = 2 }; // this line was causing the recursion c2.D_Ref1 = d1; Assert.AreSame(d1, c2.D_Ref1); Assert.AreEqual(d1.ID, c2.DID_Ref1); }
public void Bug591588_TestAssociation_OneToOne() { ScenariosEntityTestContainer ec = new ScenariosEntityTestContainer(); // set up 2 associations D d1 = new D { ID = 1 }; C c1 = new C { ID = 1, DID_Ref1 = 1 }; D d2 = new D { ID = 2 }; C c2 = new C { ID = 2, DID_Ref1 = 2 }; ec.GetEntitySet <D>().Attach(d1); ec.GetEntitySet <D>().Attach(d2); ec.GetEntitySet <C>().Attach(c1); ec.GetEntitySet <C>().Attach(c2); Assert.AreSame(d1.C, c1); Assert.AreSame(d2.C, c2); ec.GetEntitySet <C>().Remove(c1); d1.C = d2.C; Assert.AreSame(d1.C, c2); Assert.IsNull(d2.C); }
public void TestAssociation_OneToOne() { ScenariosEntityTestContainer ec = new ScenariosEntityTestContainer(); // set up association, C pointing to D D d1 = new D { ID = 1 }; C c1 = new C { ID = 1, DID_Ref1 = 1 }; ec.GetEntitySet<D>().Attach(d1); ec.GetEntitySet<C>().Attach(c1); // now point another C at the above D that is already // part of an association C c2 = new C { ID = 2 }; // this line was causing the recursion c2.D_Ref1 = d1; Assert.AreSame(d1, c2.D_Ref1); Assert.AreEqual(d1.ID, c2.DID_Ref1); }
public void Bug591588_TestAssociation_OneToOne() { ScenariosEntityTestContainer ec = new ScenariosEntityTestContainer(); // set up 2 associations D d1 = new D { ID = 1 }; C c1 = new C { ID = 1, DID_Ref1 = 1 }; D d2 = new D { ID = 2 }; C c2= new C { ID = 2, DID_Ref1 = 2 }; ec.GetEntitySet<D>().Attach(d1); ec.GetEntitySet<D>().Attach(d2); ec.GetEntitySet<C>().Attach(c1); ec.GetEntitySet<C>().Attach(c2); Assert.AreSame(d1.C, c1); Assert.AreSame(d2.C, c2); ec.GetEntitySet<C>().Remove(c1); d1.C = d2.C; Assert.AreSame(d1.C, c2); Assert.IsNull(d2.C); }