Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IsEqualTo Fails for Non-Generic IEnumerable #1718

Closed
MrKWatkins opened this issue Jan 29, 2025 · 2 comments · Fixed by #1720
Closed

IsEqualTo Fails for Non-Generic IEnumerable #1718

MrKWatkins opened this issue Jan 29, 2025 · 2 comments · Fixed by #1720

Comments

@MrKWatkins
Copy link
Contributor

I'd expect the following to pass:

[Test]
public async Task Test()
{
    IEnumerable value = new List<int> { 1, 2, 3 };
    await Assert.That(value).IsEqualTo(value);
}

But instead I get the error:

Expected value to be equal to System.Collections.Generic.List`1[System.Int32]

but found System.Linq.Enumerable+CastICollectionIterator`1[System.Object]

at Assert.That(value).IsEqualTo(value)
@MrKWatkins
Copy link
Contributor Author

IsSameReferenceAs also fails.

@Genmutant
Copy link
Contributor

Genmutant commented Jan 29, 2025

That's probably because my last request, which forces it to behave as a IEnumerable<object>:
#1707

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants