public void TestEndToAssociationResetMultiList2MultiList() { var model = new MutableModel(); var factory = new PropertiesTestFactory(model); var assoc = factory.Association(); var end = factory.AssociationEndMultiList(); end.Association = assoc; Assert.True(assoc.FirstMultiList.Count == 1); Assert.True(assoc.SecondMultiList.Count == 1); Assert.Contains(end, assoc.FirstMultiList); Assert.Contains(end, assoc.SecondMultiList); Assert.Equal(assoc, end.Association); end.Association = null; Assert.True(assoc.FirstMultiList.Count == 0); Assert.True(assoc.SecondMultiList.Count == 0); Assert.Null(end.Association); var imodel = model.ToImmutable(); var iassoc = assoc.ToImmutable(imodel); var iend = end.ToImmutable(imodel); Assert.Null(iassoc.First); Assert.Null(iassoc.Second); Assert.Null(iend.Association); }
public void TestAssociationToEndMultiList2MultiList() { var model = new MutableModel(); var factory = new PropertiesTestFactory(model); var assoc = factory.Association(); var end1 = factory.AssociationEndMultiList(); var end2 = factory.AssociationEndMultiList(); assoc.FirstMultiList.Add(end1); Assert.True(assoc.FirstMultiList.Count == 1); Assert.True(assoc.SecondMultiList.Count == 0); Assert.Contains(end1, assoc.FirstMultiList); Assert.Equal(assoc, end1.Association); Assert.Null(end2.Association); assoc.SecondMultiList.Add(end2); Assert.True(assoc.FirstMultiList.Count == 1); Assert.True(assoc.SecondMultiList.Count == 1); Assert.Contains(end1, assoc.FirstMultiList); Assert.Contains(end2, assoc.SecondMultiList); Assert.Equal(assoc, end1.Association); Assert.Equal(assoc, end2.Association); var imodel = model.ToImmutable(); var iassoc = assoc.ToImmutable(imodel); var iend1 = end1.ToImmutable(imodel); var iend2 = end2.ToImmutable(imodel); Assert.Contains(iend1, iassoc.FirstMultiList); Assert.Contains(iend2, iassoc.SecondMultiList); Assert.Equal(iassoc, iend1.Association); Assert.Equal(iassoc, iend2.Association); }
public void TestAssociationToEnd() { var model = new MutableModel(); var factory = new PropertiesTestFactory(model); var assoc = factory.Association(); var end1 = factory.AssociationEnd(); var end2 = factory.AssociationEnd(); assoc.First = end1; Assert.Equal(end1, assoc.First); Assert.Null(assoc.Second); Assert.Equal(assoc, end1.Association); Assert.Null(end2.Association); assoc.Second = end2; Assert.Equal(end1, assoc.First); Assert.Equal(end2, assoc.Second); Assert.Equal(assoc, end1.Association); Assert.Equal(assoc, end2.Association); var imodel = model.ToImmutable(); var iassoc = assoc.ToImmutable(imodel); var iend1 = end1.ToImmutable(imodel); var iend2 = end2.ToImmutable(imodel); Assert.Equal(iend1, iassoc.First); Assert.Equal(iend2, iassoc.Second); Assert.Equal(iassoc, iend1.Association); Assert.Equal(iassoc, iend2.Association); }
public void TestEndToAssociationMultiSet2MultiSet() { var model = new MutableModel(); var factory = new PropertiesTestFactory(model); var assoc = factory.Association(); var end = factory.AssociationEndMultiSet(); end.Association = assoc; Assert.Contains(end, assoc.FirstMultiSet); Assert.Contains(end, assoc.SecondMultiSet); Assert.Equal(assoc, end.Association); var imodel = model.ToImmutable(); var iassoc = assoc.ToImmutable(imodel); var iend = end.ToImmutable(imodel); Assert.Contains(iend, iassoc.FirstMultiSet); Assert.Contains(iend, iassoc.SecondMultiSet); Assert.Equal(iassoc, iend.Association); }