I'm trying to make a "strict" compare using FluentAssertions ShouldBeEquivilantTo. Everything seems to work good if the "actual value" has properties that the "expected value" does not but I need to achieve the behavior so that if the "expected value" has properties that the "actual value" does not I also need it to fail. In other words I'm looking for all properties to exist in both objects or else I expect my test to fail.
Example: I want this to fail:
var actual = new
{
a = "simple",
b = new
{
c = "complex"
}
};
var expected = new
{
a = "simple",
b = new
{
c = "complex"
},
d = "missing"
};
actual.ShouldBeEquivalentTo(expected);
Is there anyway to achieve this behavior? I have tried looking at an IMemberSelectionRule but it does not seem that ISubjectInfo nor IEquivalencyAssertionOptions contain information about the "expected value"
It's possible i'm missing something here so I apologize if this is a stupid question.
As an additional aside the reason I am comparing anonymous types is because these are responses from a WebApi controller in another assembly. I have exposed the anonymous types by adding my test suite as friendly using the [assembly: InternalsVisibleTo("testsuite")] notation.