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
Labels

Comments

@quinmars
Copy link

@quinmars quinmars commented Oct 19, 2019

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

This comment has been minimized.

Copy link
Member

@dennisdoomen dennisdoomen commented Oct 20, 2019

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
@jnyrup jnyrup closed this in #1169 Oct 26, 2019
@quinmars

This comment has been minimized.

Copy link
Author

@quinmars quinmars commented Oct 26, 2019

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.