If I use ShouldBe to compare a list of KeyValuePair and a dictionary I get no error
Messoz opened this issue · comments
Marco Messora commented
Hello,
This test has success result. Shouldn't an assertion of this kind fail?
[Fact]
public async Task ShouldBeProblem()
{
var list_kv = new List<KeyValuePair<string, string>>
{
new("1", "2")
};
var dic = new Dictionary<string, string>()
{
{"1","2"}
};
list_kv.ShouldBe(dic);
}
Shouldly Version 4.1.0
FrameWorks And Dependency
.NETStandard 2.0
DiffEngine ≥ 10.0.0
EmptyFiles ≥ 2.8.0
Microsoft.CSharp ≥ 4.7.0
Joseph Musser commented
I don't think it should fail. It's pretty common for .ShouldBe(new[] { 1, 2 })
or similar to be used on a collection that isn't an array necessarily, for instance. If the exact type matters, that should be an explicit additional .ShouldBeOfType<List<KeyValuePair<string, string>>>()
assertion.