Skip to content

Commit 1a9f949

Browse files
Dto mapping test improved
1 parent 284bccf commit 1a9f949

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tests/Application.UnitTests/Common/Mappings/MappingTests.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,20 @@ public void ShouldHaveValidConfiguration()
2929
}
3030

3131
[Test]
32-
[TestCase(typeof(Document), typeof(DocumentDto))]
33-
[TestCase(typeof(KeyValue), typeof(KeyValueDto))]
34-
[TestCase(typeof(Product), typeof(ProductDto))]
35-
[TestCase(typeof(ProductDto), typeof(Product))]
36-
[TestCase(typeof(KeyValueDto), typeof(KeyValue))]
37-
[TestCase(typeof(DocumentDto), typeof(Document))]
38-
public void ShouldSupportMappingFromSourceToDestination(Type source, Type destination)
32+
[TestCase(typeof(Document), typeof(DocumentDto), true)]
33+
[TestCase(typeof(KeyValue), typeof(KeyValueDto), true)]
34+
[TestCase(typeof(Product), typeof(ProductDto), true)]
35+
36+
public void ShouldSupportMappingFromSourceToDestination(Type source, Type destination, bool inverseMap = false)
3937
{
4038
var instance = GetInstanceOf(source);
4139

4240
_mapper.Map(instance, source, destination);
41+
42+
if (inverseMap)
43+
{
44+
ShouldSupportMappingFromSourceToDestination(destination, source, false);
45+
}
4346
}
4447

4548
private object GetInstanceOf(Type type)

0 commit comments

Comments
 (0)