Override the comparison of generic type #1883
-
Hello! I have a problem with overriding the comparison of open generic type. public interface IStatus
{
string Status { get; set; }
}
public class MyClass<T> : IStatus
{
public T Value { get; set; }
public string Status { get; set; }
} And I can configure it like this AssertionOptions.AssertEquivalencyUsing(opts => opts
.ComparingByMembers(typeof(MyClass<>))
.Using<MyClass<int>>(ctx =>
{
if (ctx.Subject.Status != "Set")
{
ctx.Subject.Status.Should().Be(ctx.Expectation.Status);
}
else
{
ctx.Subject.Value.Should().Be(ctx.Expectation.Value);
}
})
.WhenTypeIs<MyClass<int>>()); So my question is: Is it possible to configure |
Beta Was this translation helpful? Give feedback.
Answered by
dennisdoomen
Apr 7, 2022
Replies: 1 comment 1 reply
-
Other than reverting to Reflectin, can't think of anything to make that possible. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jnyrup
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Other than reverting to Reflectin, can't think of anything to make that possible.