Skip to content

Commit 21741fb

Browse files
committed
Test coverage for ReadOnlyCollectionWrapper use when mapping from a dictionary to a root simple type array
1 parent f95f037 commit 21741fb

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

AgileMapper.UnitTests/WhenMappingFromDictionaries.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,23 @@ public void ShouldPopulateANestedSimpleTypeCollectionFromConvertibleTypedEntries
207207
now.AddHours(2).ToCurrentCultureString());
208208
}
209209

210+
[Fact]
211+
public void ShouldPopulateARootSimpleTypeArrayFromConvertibleTypedEntries()
212+
{
213+
var source = new Dictionary<string, long>
214+
{
215+
["[0]"] = 123,
216+
["[1]"] = long.MaxValue,
217+
["[2]"] = 789
218+
};
219+
var result = Mapper.Map(source).ToANew<int[]>();
220+
221+
result.Length.ShouldBe(3);
222+
result.First().ShouldBe(123);
223+
result.Second().ShouldBeDefault();
224+
result.Third().ShouldBe(789);
225+
}
226+
210227
[Fact]
211228
public void ShouldPopulateARootComplexTypeListFromUntypedEntries()
212229
{

0 commit comments

Comments
 (0)