I have public class RuleInfo
which is created from internal class Rule
.
private static RuleInfo CreateRuleInfo(Rule r)
{
return new RuleInfo
{
RuleCode = r.RuleId,
DisplayName = r.RuleCode,
Description = r.Description,
LegacyRuleCode = null
};
}
They vary in their properties names so ShouldBeEquivalentTo()
or ShouldAllBeEquivalentTo()
don't work.
Right now I'm comparing them manually/explicitly:
foreach (var x in Enumerable.Zip(infs, rules, (i, r) => new { Info = i, Rule = r }))
{
x.Info.ShouldBeEquivalentTo(
new
{
RuleCode = x.Rule.RuleId,
DisplayName = x.Rule.RuleCode,
Description = x.Rule.Description,
LegacyRuleCode = (string)null
});
}
Is there a better, more compact, less explicit, more readable way?