I'm using xUnit.net, AutoFixture and SemanticComparison and want to verify the results of a mapping.
On the individual item level, I'm well covered.
Given
- The items share an identifying key
- I want to do a comparison on the value elements on both side
- I don't care about ordering (and don't want my Assertion to break under re-ordering)
How do I verify that each and every input item maps to one and only one output item in a DAMP yet DRY manner using as much OOTB componentry as possible ?
Fixtures:
class Input
{
public string Name, Description;
}
class Output
{
public string Name, Description, IgnoreThisField;
}
Skeleton Test:
[Theory,AutoData]
void MappingWorks( Mapper sut, Input[] inputs)
{
var outputs = sut.Map( inputs);
// TODO assert that every input is mapped
// TODO assert that we have have no extra outputs
}
Given a [very neat] FullOuterJoin operation and xUnit.net V2, you can express it as:
Given some
AssertResemblance.Like
Collection helpers[1], youSemanticComparison
grows a feature I don't think it can be usefully generalised)Ploeh.SemanticComparison
'sLikeness
do the matching onName
Final result is:
[1]