I've been using ShouldBeEquivalentTo() to compare 2 dictionaries, which works fine.
What I want to be do is check that the keys are the same, while the values can be within a range (say within 1 %) through the assertion options. Is this possible?
At the moment I'm doing the following (both dictionaries are sorted by key):
What I want to be do is check that the keys are the same, while the values can be within a range (say within 1 %) through the assertion options. Is this possible?
At the moment I'm doing the following (both dictionaries are sorted by key):
foreach (var o in actual)
{
expectedValues.Should().ContainKey(o.Key);
o.Value.Should().BeInRange(oo.Value*0.99, oo.Value*1.01);
}
Which works but doesn't look very elegant...