コード例 #1
0
        public void TestFormLimitFunctionOnReferencePropertyInfo2()
        {
            var territory    = new Territory2();
            var propertyList = new List <string> {
                "Property1"
            };
            var resultFunction = InterfaceBusinessServer.FormLimitFunctionOnReferencePropertyInfo(propertyList, territory);

            Assert.Equal(string.Format("OR ( = ( {1} {0} ) )", territory.__PrimaryKey, propertyList[0]), resultFunction.ToString());
        }
コード例 #2
0
        public void TestFormViewOnReferencePropertyInfo()
        {
            var someReferencePropertyInfo = InterfaceBusinessServer.ReferencePropertyInfo.FormList(typeof(Territory2).Assembly, typeof(Territory2)).FirstOrDefault();

            Assert.NotNull(someReferencePropertyInfo);
            var resultView = InterfaceBusinessServer.FormViewOnReferencePropertyInfo(someReferencePropertyInfo);

            Assert.Equal(someReferencePropertyInfo.TypeWithReference, resultView.DefineClassType);
            Assert.Equal(someReferencePropertyInfo.ReferenceProperties.Count, resultView.Properties.Count());
            foreach (var currentProperty in someReferencePropertyInfo.ReferenceProperties)
            {
                Assert.False(string.IsNullOrEmpty(resultView.Properties.Where(x => x.Name == currentProperty).Select(x => x.Name).FirstOrDefault()));
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }