我想知道是否有办法比较两个不同类型的列表。我找到了这个方法:
public AndConstraint<TAssertions> Equal(IEnumerable<T> expectation, Func<T, T, bool> predicate, string because = "", params object[] reasonArgs)
{
this.AssertSubjectEquality<T>((IEnumerable) expectation, predicate, because, reasonArgs);
return new AndConstraint<TAssertions>((TAssertions) this);
}
我正在寻找类似的东西:
public AndConstraint<TAssertions> Equal<U>(IEnumerable<T> expectation, Func<T, U, bool> predicate, string because = "", params object[] reasonArgs)
{
this.AssertSubjectEquality<T,U>((IEnumerable) expectation, predicate, because, reasonArgs);
return new AndConstraint<TAssertions>((TAssertions) this);
}
我试图做一个扩展方法,但方法AssertSubjectEquality是受保护的,不支持第二种类型。