Esempio n. 1
0
        public void TestWifeToHusband()
        {
            var model   = new MutableModel();
            var factory = new PropertiesTestFactory(model);
            var husband = factory.Husband();
            var wife    = factory.Wife();

            wife.Husband = husband;
            Assert.Equal(wife, husband.Wife);
            Assert.Equal(husband, wife.Husband);
            var imodel   = model.ToImmutable();
            var ihusband = husband.ToImmutable(imodel);
            var iwife    = wife.ToImmutable(imodel);

            Assert.Equal(iwife, ihusband.Wife);
            Assert.Equal(ihusband, iwife.Husband);
        }
Esempio n. 2
0
        public void TestHusbandToWifeCrossReset()
        {
            var model   = new MutableModel();
            var factory = new PropertiesTestFactory(model);
            var husband = factory.Husband();
            var wife    = factory.Wife();

            husband.Wife = wife;
            Assert.Equal(wife, husband.Wife);
            Assert.Equal(husband, wife.Husband);
            wife.Husband = null;
            Assert.Null(husband.Wife);
            Assert.Null(wife.Husband);
            var imodel   = model.ToImmutable();
            var ihusband = husband.ToImmutable(imodel);
            var iwife    = wife.ToImmutable(imodel);

            Assert.Null(ihusband.Wife);
            Assert.Null(iwife.Husband);
        }