public void CheckLoadedPropertiesGenericTest1()
        {
            var client = new Клиент();

            // Мы только создали объект, он не является загруженным.
            Assert.False(client.CheckLoadedProperties(x => x.Прописка));
        }
        public void TestToStringForAuditNormalView()
        {
            string propertyNameFio    = Information.ExtractPropertyPath <Клиент>(x => x.ФИО);
            string propertyCaptionFio = "SomeFIOCaption";
            string propertyValueFio   = "SomeFIOValue";

            string propertyNameAdress    = Information.ExtractPropertyPath <Клиент>(x => x.Прописка);
            string propertyCaptionAdress = "SomeAdressCaption";
            string propertyValueAdress   = "SomeAdressValue";

            var client = new Клиент {
                ФИО = propertyValueFio, Прописка = propertyValueAdress
            };
            var view = new View {
                DefineClassType = typeof(Клиент)
            };

            view.AddProperty(propertyNameFio, propertyCaptionFio, true, string.Empty);
            view.AddProperty(propertyNameAdress, propertyCaptionAdress, true, string.Empty);
            string expectedToString = string.Format("Клиент({0}={1}, {2}={3})", propertyCaptionFio, propertyValueFio, propertyCaptionAdress, propertyValueAdress);

            string resultToString = client.ToStringForAudit(view);

            Assert.Equal(expectedToString, resultToString);
        }
        public void IsAlteredPropertiesGenericTest1()
        {
            var client = new Клиент();

            // Мы только создали объект, все свойства Altered.
            Assert.True(client.IsAlteredProperties(x => x.Прописка));
        }
        public void IsAlteredPropertiesGenericTest4()
        {
            var client = new Клиент();

            client.SetExistObjectPrimaryKey(Guid.NewGuid());
            client.InitDataCopy();

            Assert.False(client.IsAlteredProperties(x => x.Прописка, x => x.ФИО));
        }
        public void CheckLoadedPropertiesGenericTest4()
        {
            var client = new Клиент {
                Прописка = "Knowhere", ФИО = "Mr. Nobody"
            };

            client.SetLoadedProperties(nameof(Клиент.Прописка), nameof(Клиент.ФИО));

            Assert.True(client.CheckLoadedProperties(x => x.Прописка, x => x.ФИО));
        }
        public void CheckLoadedPropertiesGenericTest2()
        {
            var client = new Клиент {
                Прописка = "Knowhere"
            };

            client.SetLoadedProperties(nameof(Клиент.Прописка));

            Assert.True(client.CheckLoadedProperties(x => x.Прописка));
        }
        public void TestToStringForAuditEmptyView()
        {
            var client = new Клиент();
            var view   = new View()
            {
                DefineClassType = typeof(Клиент)
            };

            string resultToString = client.ToStringForAudit(view);

            Assert.Equal("Клиент()", resultToString);
        }
        public void TestToStringForAuditNormalViewWithInvisibleProperties()
        {
            string propertyCaption = "SomePropertyCaption";
            string propertyValue   = "SomePropertyValue";
            var    client          = new Клиент {
                ФИО = propertyValue
            };
            var view = new View {
                DefineClassType = typeof(Клиент)
            };

            view.AddProperty(Information.ExtractPropertyPath <Клиент>(x => x.ФИО), propertyCaption, true, string.Empty);
            view.AddProperty(Information.ExtractPropertyPath <Клиент>(x => x.Прописка), "OtherCaption", false, string.Empty);
            string expectedToString = string.Format("Клиент({0}={1})", propertyCaption, propertyValue);

            string resultToString = client.ToStringForAudit(view);

            Assert.Equal(expectedToString, resultToString);
        }