forked from AutoMapper/AutoMapper
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug where the interface matching got overwritten
- Loading branch information
Showing
4 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using NBehave.Spec.NUnit; | ||
using NUnit.Framework; | ||
|
||
namespace AutoMapper.UnitTests.Bug | ||
{ | ||
[TestFixture] | ||
public class MultipleInterfaceInheritance : AutoMapperSpecBase | ||
{ | ||
private ThingDto _thingDto; | ||
|
||
public class Thing | ||
{ | ||
public IItem[] Items { get; set; } | ||
} | ||
|
||
public class ThingDto | ||
{ | ||
public ItemDto[] Items { get; set; } | ||
} | ||
|
||
public class Item : IItem | ||
{ | ||
} | ||
|
||
public class ItemDto | ||
{ | ||
} | ||
|
||
public interface IItem : ISome // everything works well if IItem doesn't inherit ISome. | ||
{ | ||
} | ||
|
||
public interface ISome | ||
{ | ||
} | ||
|
||
protected override void Establish_context() | ||
{ | ||
Mapper.Initialize(cfg => | ||
{ | ||
cfg.CreateMap<Thing, ThingDto>(); | ||
cfg.CreateMap<IItem, ItemDto>(); | ||
}); | ||
} | ||
|
||
protected override void Because_of() | ||
{ | ||
var thing = new Thing { Items = new[] { new Item() } }; | ||
_thingDto = Mapper.Map<Thing, ThingDto>(thing); | ||
} | ||
|
||
[Test] | ||
public void Should_map_successfully() | ||
{ | ||
_thingDto.Items.Length.ShouldEqual(1); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters