public void TestNullifyMasterReferences2()
        {
            var exception = Xunit.Record.Exception(() =>
            {
                var resultList             = InterfaceBusinessServer.ReferencePropertyInfo.FormList(typeof(Country2).Assembly, typeof(Country2));
                var masterObject           = new Country2();
                var referencingDataObjects = new List <DataObject> {
                    new Apparatus2 {
                        Maker = masterObject, Exporter = masterObject
                    }
                };

                InterfaceBusinessServer.NullifyMasterReferences(masterObject, referencingDataObjects, resultList);
            });

            Assert.IsType(typeof(PropertyCouldnotBeNullException), exception);
        }
        public void TestNullifyMasterReferences()
        {
            var resultList       = InterfaceBusinessServer.ReferencePropertyInfo.FormList(typeof(Country2).Assembly, typeof(Country2));
            var masterObject     = new Country2();
            var masterObjectCopy = new Country2 {
                __PrimaryKey = masterObject.__PrimaryKey
            };
            var otherCountry           = new Country2();
            var referencingDataObjects = new List <DataObject>
            {
                new Adress2 {
                    Country = otherCountry
                },
                new Apparatus2 {
                    Maker = masterObject, Exporter = otherCountry
                },
                new Human2 {
                    TodayHome = masterObjectCopy
                },
                new Place2 {
                    TodayTerritory = masterObject, TomorrowTeritory = otherCountry
                },
                new Apparatus2 {
                    Maker = otherCountry, Exporter = otherCountry
                },
                new Human2 {
                    TodayHome = otherCountry
                },
                new Place2 {
                    TodayTerritory = otherCountry, TomorrowTeritory = otherCountry
                }
            };

            InterfaceBusinessServer.NullifyMasterReferences(masterObject, referencingDataObjects, resultList);
            Assert.Null(((Apparatus2)referencingDataObjects[1]).Maker);
            Assert.Null(((Human2)referencingDataObjects[2]).TodayHome);
            Assert.Null(((Place2)referencingDataObjects[3]).TodayTerritory);
            Assert.NotNull(((Apparatus2)referencingDataObjects[4]).Maker);
            Assert.NotNull(((Human2)referencingDataObjects[5]).TodayHome);
            Assert.NotNull(((Place2)referencingDataObjects[6]).TodayTerritory);
        }