|
|
@ -18,7 +18,8 @@ public class HasExtraPropertiesObjectExtendingExtensions_Tests : AbpObjectExtend |
|
|
.SetProperty("ChildCount", 2) |
|
|
.SetProperty("ChildCount", 2) |
|
|
.SetProperty("Sex", "male") |
|
|
.SetProperty("Sex", "male") |
|
|
.SetProperty("NoPairCheck", "test-value") |
|
|
.SetProperty("NoPairCheck", "test-value") |
|
|
.SetProperty("CityName", "Adana"); |
|
|
.SetProperty("CityName", "Adana") |
|
|
|
|
|
.SetProperty("EnumProperty", (int)ExtensibleTestEnumProperty.Value1); |
|
|
|
|
|
|
|
|
_personDto = new ExtensibleTestPersonDto() |
|
|
_personDto = new ExtensibleTestPersonDto() |
|
|
.SetProperty("ExistingDtoProperty", "existing-value"); |
|
|
.SetProperty("ExistingDtoProperty", "existing-value"); |
|
|
@ -31,6 +32,7 @@ public class HasExtraPropertiesObjectExtendingExtensions_Tests : AbpObjectExtend |
|
|
|
|
|
|
|
|
_personDto.GetProperty<string>("Name").ShouldBe("John"); //Defined in both classes
|
|
|
_personDto.GetProperty<string>("Name").ShouldBe("John"); //Defined in both classes
|
|
|
_personDto.GetProperty<string>("CityName").ShouldBe("Adana"); //Defined in both classes
|
|
|
_personDto.GetProperty<string>("CityName").ShouldBe("Adana"); //Defined in both classes
|
|
|
|
|
|
_personDto.GetProperty<ExtensibleTestEnumProperty>("EnumProperty").ShouldBe(ExtensibleTestEnumProperty.Value1); //Defined in both classes
|
|
|
_personDto.GetProperty<string>("NoPairCheck").ShouldBe("test-value"); //CheckPairDefinitionOnMapping = false
|
|
|
_personDto.GetProperty<string>("NoPairCheck").ShouldBe("test-value"); //CheckPairDefinitionOnMapping = false
|
|
|
_personDto.GetProperty<string>("ExistingDtoProperty").ShouldBe("existing-value"); //Should not clear existing values
|
|
|
_personDto.GetProperty<string>("ExistingDtoProperty").ShouldBe("existing-value"); //Should not clear existing values
|
|
|
_personDto.HasProperty("Age").ShouldBeFalse(); //Not defined on the destination
|
|
|
_personDto.HasProperty("Age").ShouldBeFalse(); //Not defined on the destination
|
|
|
@ -44,6 +46,7 @@ public class HasExtraPropertiesObjectExtendingExtensions_Tests : AbpObjectExtend |
|
|
_person.MapExtraPropertiesTo(_personDto, ignoredProperties: new[] { "CityName" }); |
|
|
_person.MapExtraPropertiesTo(_personDto, ignoredProperties: new[] { "CityName" }); |
|
|
|
|
|
|
|
|
_personDto.GetProperty<string>("Name").ShouldBe("John"); //Defined in both classes
|
|
|
_personDto.GetProperty<string>("Name").ShouldBe("John"); //Defined in both classes
|
|
|
|
|
|
_personDto.GetProperty<ExtensibleTestEnumProperty>("EnumProperty").ShouldBe(ExtensibleTestEnumProperty.Value1); //Defined in both classes
|
|
|
_personDto.GetProperty<string>("NoPairCheck").ShouldBe("test-value"); //CheckPairDefinitionOnMapping = false
|
|
|
_personDto.GetProperty<string>("NoPairCheck").ShouldBe("test-value"); //CheckPairDefinitionOnMapping = false
|
|
|
_personDto.GetProperty<string>("ExistingDtoProperty").ShouldBe("existing-value"); //Should not clear existing values
|
|
|
_personDto.GetProperty<string>("ExistingDtoProperty").ShouldBe("existing-value"); //Should not clear existing values
|
|
|
_personDto.GetProperty<string>("CityName").ShouldBeNull(); //Ignored, but was set to the default in the constructor
|
|
|
_personDto.GetProperty<string>("CityName").ShouldBeNull(); //Ignored, but was set to the default in the constructor
|
|
|
@ -59,6 +62,7 @@ public class HasExtraPropertiesObjectExtendingExtensions_Tests : AbpObjectExtend |
|
|
|
|
|
|
|
|
_personDto.GetProperty<string>("Name").ShouldBe("John"); //Defined in both classes
|
|
|
_personDto.GetProperty<string>("Name").ShouldBe("John"); //Defined in both classes
|
|
|
_personDto.GetProperty<string>("CityName").ShouldBe("Adana"); //Defined in both classes
|
|
|
_personDto.GetProperty<string>("CityName").ShouldBe("Adana"); //Defined in both classes
|
|
|
|
|
|
_personDto.GetProperty<ExtensibleTestEnumProperty>("EnumProperty").ShouldBe(ExtensibleTestEnumProperty.Value1); //Defined in both classes
|
|
|
_personDto.GetProperty<int>("Age").ShouldBe(42); //Defined in source
|
|
|
_personDto.GetProperty<int>("Age").ShouldBe(42); //Defined in source
|
|
|
_personDto.GetProperty<string>("ExistingDtoProperty").ShouldBe("existing-value"); //Should not clear existing values
|
|
|
_personDto.GetProperty<string>("ExistingDtoProperty").ShouldBe("existing-value"); //Should not clear existing values
|
|
|
_personDto.GetProperty<int>("ChildCount").ShouldBe(0); //Not defined in the source, but was set to the default in the constructor
|
|
|
_personDto.GetProperty<int>("ChildCount").ShouldBe(0); //Not defined in the source, but was set to the default in the constructor
|
|
|
@ -72,6 +76,7 @@ public class HasExtraPropertiesObjectExtendingExtensions_Tests : AbpObjectExtend |
|
|
|
|
|
|
|
|
_personDto.GetProperty<string>("Name").ShouldBe("John"); //Defined in both classes
|
|
|
_personDto.GetProperty<string>("Name").ShouldBe("John"); //Defined in both classes
|
|
|
_personDto.GetProperty<string>("CityName").ShouldBe("Adana"); //Defined in both classes
|
|
|
_personDto.GetProperty<string>("CityName").ShouldBe("Adana"); //Defined in both classes
|
|
|
|
|
|
_personDto.GetProperty<ExtensibleTestEnumProperty>("EnumProperty").ShouldBe(ExtensibleTestEnumProperty.Value1); //Defined in both classes
|
|
|
_personDto.GetProperty<int>("ChildCount").ShouldBe(2); //Defined in destination
|
|
|
_personDto.GetProperty<int>("ChildCount").ShouldBe(2); //Defined in destination
|
|
|
_personDto.GetProperty<string>("ExistingDtoProperty").ShouldBe("existing-value"); //Should not clear existing values
|
|
|
_personDto.GetProperty<string>("ExistingDtoProperty").ShouldBe("existing-value"); //Should not clear existing values
|
|
|
_personDto.HasProperty("Age").ShouldBeFalse(); //Not defined in destination
|
|
|
_personDto.HasProperty("Age").ShouldBeFalse(); //Not defined in destination
|
|
|
@ -88,6 +93,7 @@ public class HasExtraPropertiesObjectExtendingExtensions_Tests : AbpObjectExtend |
|
|
_personDto.GetProperty<int>("Age").ShouldBe(42); |
|
|
_personDto.GetProperty<int>("Age").ShouldBe(42); |
|
|
_personDto.GetProperty<int>("ChildCount").ShouldBe(2); |
|
|
_personDto.GetProperty<int>("ChildCount").ShouldBe(2); |
|
|
_personDto.GetProperty<string>("Sex").ShouldBe("male"); |
|
|
_personDto.GetProperty<string>("Sex").ShouldBe("male"); |
|
|
|
|
|
_personDto.GetProperty<ExtensibleTestEnumProperty>("EnumProperty").ShouldBe(ExtensibleTestEnumProperty.Value1); |
|
|
_personDto.GetProperty<string>("ExistingDtoProperty").ShouldBe("existing-value"); //Should not clear existing values
|
|
|
_personDto.GetProperty<string>("ExistingDtoProperty").ShouldBe("existing-value"); //Should not clear existing values
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|