public void GetInitializedPropertiesWithMasterTest() { // Входной параметр: объект класса DataObjectForTest. var dObj = new DataObjectForTest(); var actual = dObj.GetInitializedProperties(true); // Ожидаемый результат: массив строк {"Name", "Height", "BirthDate", "Gender", "_PrimaryKey"}. var expected = new string[] { "Name", "Height", "BirthDate", "Gender", "__PrimaryKey" }; Assert.True(EquivalenceMethods.EqualStringArrays(actual, expected)); var actual1 = dObj.GetInitializedProperties(false); Assert.True(EquivalenceMethods.EqualStringArrays(actual1, expected)); }
public void GetInitializedPropertiesTest() { var dObj = new DataObjectForTest { Name = "Вася" }; string[] expected = { Information.ExtractPropertyPath <DataObjectForTest>(x => x.Name), Information.ExtractPropertyPath <DataObjectForTest>(x => x.Height), Information.ExtractPropertyPath <DataObjectForTest>(x => x.BirthDate), Information.ExtractPropertyPath <DataObjectForTest>(x => x.Gender), Information.ExtractPropertyPath <DataObjectForTest>(x => x.__PrimaryKey) }; string[] actual = dObj.GetInitializedProperties(); Assert.True(EquivalenceMethods.EqualStringArrays(expected, actual)); var obj = new ClassWithCaptions(); string[] expected1 = { Information.ExtractPropertyPath <ClassWithCaptions>(x => x.InformationTestClass4), Information.ExtractPropertyPath <ClassWithCaptions>(x => x.__PrimaryKey) }; string[] actual1 = obj.GetInitializedProperties(); Assert.True(EquivalenceMethods.EqualStringArrays(expected1, actual1)); }
public void CopySysPropsTest() { // Входной параметр: новый объект класса DataObjectForTest(). var dObj = new DataObjectForTest { Name = "Вася", __PrimaryKey = "C2EE01FC-1664-4005-AADB-968809E32E33" }; var result = new DataObjectForTest(); dObj.CopySysProps(result); result.GetInitializedProperties(); // Ожидаемый результат: значения поля __PrimaryKey у исходного и скопированого объектов совпадают, а значения поля Name - нет. Assert.Equal(dObj.__PrimaryKey, result.__PrimaryKey); Assert.NotEqual(dObj.Name, result.Name); }