This project has moved. For the latest updates, please go here.
1

Closed

Assert.ConfigurationIsValid throws an exception when target is constructed with ConstructUsing

description

IMO when defining mapping thru ConstructUsing it means we don't want / need to define full mapping for target properties. Hence Assert.ConfigurationIsValid should ignore not-mapped properties on targets resolved with ConstructUsing.

Example with failed expectation:
public class IdentifierBase
{
    public string Id { get; private set; }
    public IdentifierBase(string id)
    {
        Id = id;
    }
}

[TestFixture]
public class MappingTest
{
    [Test]
    public void ShouldNotRequireFieldsMappingWhenConstructUning()
    {
        Mapper.CreateMap<string, IdentifierBase>().ConstructUsing(o => new IdentifierBase(o));
        Assert.DoesNotThrow(() =>  Mapper.AssertConfigurationIsValid());
    }
}
Closed Jul 30, 2015 at 2:03 PM by jbogard
The project has moved to github.

comments