public void Should_Map_Private_Field_To_New_Object_Correctly() { SetUpMappingNonPublicFields <CustomerWithPrivateField, CustomerDTO>(); var customerId = 1; var customerName = "Customer 1"; var aCustomer = new CustomerWithPrivateField(customerId, customerName); var dto = aCustomer.Adapt <CustomerDTO>(); Assert.IsNotNull(dto); dto.Id.ShouldBe(customerId); dto.Name.ShouldBe(customerName); }
public void Default_Settings_Should_Not_Map_Private_Fields_To_New_Object() { TypeAdapterConfig <CustomerWithPrivateField, CustomerDTO> .NewConfig() .NameMatchingStrategy(NameMatchingStrategy.Flexible); var customerId = 1; var customerName = "Customer 1"; var aCustomer = new CustomerWithPrivateField(customerId, customerName); var dto = aCustomer.Adapt <CustomerDTO>(); Assert.IsNotNull(dto); dto.Id.ShouldNotBe(customerId); dto.Name.ShouldBe(customerName); }