In Fluent Assertions when comparing objects with DateTime properties there are sometimes a slight mismatch in the milliseconds and the comparison fail. The way we get around it
I am afraid the closest thing you can come to, is providing new methods
public static void ShouldBeEquivalentToDef(this T subject, object expectation, string reason = "",
params object[] reasonArgs)
{
ShouldBeEquivalentToDef(subject, expectation, config => config, reason, reasonArgs);
}
public static void ShouldBeEquivalentToDef(this T subject, object expectation,
Func, EquivalencyAssertionOptions> config, string reason = "", params object[] reasonArgs)
{
var context = new EquivalencyValidationContext
{
Subject = subject,
Expectation = expectation,
CompileTimeType = typeof (T),
Reason = reason,
ReasonArgs = reasonArgs
};
var defConstructedOptions = config(EquivalencyAssertionOptions.Default());
defConstructedOptions.Using(ctx => ctx.Subject.Should().BeCloseTo(ctx.Expectation))
.WhenTypeIs()
new EquivalencyValidator(defConstructedOptions).AssertEquality(context);
}