Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
public static void ShouldBeStructurallyEqualTo<T, U>(this IEnumerable<T> actual, IEnumerable<U> expected)
{
var actualList = actual.ToList();
var expectedList = expected.ToList();
actualList.Should().HaveCount(expectedList.Count());
bool isArrayOfValueType = typeof (T).IsArray && typeof (T).GetElementType().IsValueType;
foreach (var pair in actualList.Zip(expectedList, Tuple.Create))
{
if (isArrayOfValueType)
(pair.Item1 as IEnumerable).Should().BeEquivalentTo(pair.Item2 as IEnumerable);
else
pair.Item1.ShouldHave().AllProperties().IncludingNestedObjects().EqualTo(pair.Item2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.