Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 963d1c9

Browse files
committed
add tests against mapping from Arrays and Hashsets
1 parent e15e769 commit 963d1c9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/ServiceStack.Text.Tests/AutoMappingTests.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,18 @@ public void Does_convert_models_with_collections()
424424
Assert.That(MatchesUsers(from.Collection, from.Collection.ConvertTo<List<User>>()));
425425
Assert.That(MatchesUsers(from.Collection, from.Collection.ConvertTo<User[]>()));
426426
Assert.That(MatchesUsers(from.Collection, from.Collection.ConvertTo<HashSet<User>>()));
427+
428+
var array = from.Collection.ToArray();
429+
Assert.That(MatchesUsers(array, from.Collection.ConvertTo<IEnumerable<User>>()));
430+
Assert.That(MatchesUsers(array, from.Collection.ConvertTo<List<User>>()));
431+
Assert.That(MatchesUsers(array, from.Collection.ConvertTo<User[]>()));
432+
Assert.That(MatchesUsers(array, from.Collection.ConvertTo<HashSet<User>>()));
433+
434+
var hashset = from.Collection.ToHashSet();
435+
Assert.That(MatchesUsers(hashset, from.Collection.ConvertTo<IEnumerable<User>>()));
436+
Assert.That(MatchesUsers(hashset, from.Collection.ConvertTo<List<User>>()));
437+
Assert.That(MatchesUsers(hashset, from.Collection.ConvertTo<User[]>()));
438+
Assert.That(MatchesUsers(hashset, from.Collection.ConvertTo<HashSet<User>>()));
427439
}
428440
}
429441
}

0 commit comments

Comments
 (0)