Пример #1
0
        public void TestEndToAssociationResetSet2Set()
        {
            var model   = new MutableModel();
            var factory = new PropertiesTestFactory(model);
            var assoc   = factory.Association();
            var end     = factory.AssociationEndSet();

            end.Association = assoc;
            Assert.True(assoc.FirstSet.Count == 1);
            Assert.True(assoc.SecondSet.Count == 1);
            Assert.Contains(end, assoc.FirstSet);
            Assert.Contains(end, assoc.SecondSet);
            Assert.Equal(assoc, end.Association);
            end.Association = null;
            Assert.True(assoc.FirstSet.Count == 0);
            Assert.True(assoc.SecondSet.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);
        }