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

Equivalency of multidimensional arrays with zero size width #1167

Closed
quinmars opened this issue Oct 19, 2019 · 2 comments · Fixed by #1169
Closed

Equivalency of multidimensional arrays with zero size width #1167

quinmars opened this issue Oct 19, 2019 · 2 comments · Fixed by #1169
Assignees

Comments

@quinmars
Copy link

Following code throws an exception (System.IndexOutOfRangeException : Index was outside the bounds of the array.):

[Fact]
public void Test()
{
    Array a = new long[1,0] { { } };
    Array b = new long[1,0] { { } };

    a
        .Should().BeEquivalentTo(b);
}

I'd expect a to be equivalent to b.

I'm using version 5.9.0 of FluentAssertions.

@dennisdoomen
Copy link
Member

Defintiely a bug.

@jnyrup jnyrup self-assigned this Oct 25, 2019
jnyrup added a commit to jnyrup/fluentassertions that referenced this issue Oct 25, 2019
When comparing multi-dimensional `Array`s using `BeEquivalentTo`
we weren't handling the case of empty `Array`s, which threw an
`IndexOutOfRangeException` when it tried to get an element.
This fixes fluentassertions#1167
jnyrup added a commit to jnyrup/fluentassertions that referenced this issue Oct 25, 2019
When comparing multi-dimensional `Array`s using `BeEquivalentTo`
we weren't handling the case of empty `Array`s, which threw an
`IndexOutOfRangeException` when it tried to get an element.
This fixes fluentassertions#1167
jnyrup added a commit to jnyrup/fluentassertions that referenced this issue Oct 26, 2019
When comparing multi-dimensional `Array`s using `BeEquivalentTo`
we weren't handling the case of empty `Array`s, which threw an
`IndexOutOfRangeException` when it tried to get an element.
This fixes fluentassertions#1167
@quinmars
Copy link
Author

Thank you!

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

Successfully merging a pull request may close this issue.

3 participants