Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmada committed Apr 21, 2021
1 parent 854bfe5 commit 24e8109
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void BeEqualTo_With_ExceptionOnCurrent_Should_Throw()
{
// Arrange
var actual = new ExceptionInCurrentEnumerable<int>();
var expected = Array.Empty<int>();
var expected = new[] { 0 };

// Act
void action() => actual.Must().BeEnumerableOf<int>().BeEqualTo(expected);
Expand Down
11 changes: 8 additions & 3 deletions NetFabric.Assertive/Utils/EnumerableEqualityComparer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,18 @@ static Expression InvokeDispose(Expression expression, EnumerableInfo enumerable
)
);
}

static Expression NewEnumerationException(MemberInfo memberInfo, Expression innerException)
=> New(
{
var parentheses = memberInfo.MemberType == MemberTypes.Method
? "()"
: string.Empty;
return New(
typeof(EnumerationException).GetConstructor(new[] {typeof(string), typeof(Exception)})!,
Constant($"Unhandled exception in {memberInfo.DeclaringType!.Name}.{memberInfo.Name}()."),
Constant($"Unhandled exception in {memberInfo.DeclaringType!.Name}.{memberInfo.Name}{parentheses}."),
innerException
);
}

public static async Task<(EqualityResult, int, TActualItem?, TExpectedItem?)> Compare<TActualItem, TExpected, TExpectedItem>(this IAsyncEnumerable<TActualItem> actual, TExpected expected, Func<TActualItem, TExpectedItem, bool> comparer)
where TExpected : IEnumerable<TExpectedItem>
Expand Down

0 comments on commit 24e8109

Please sign in to comment.