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

Trying to mock a multidimensional array fails #311

Closed
njannink opened this issue Dec 20, 2016 · 2 comments
Closed

Trying to mock a multidimensional array fails #311

njannink opened this issue Dec 20, 2016 · 2 comments
Assignees

Comments

@njannink
Copy link

njannink commented Dec 20, 2016

Trying to perform Mock.Of of a interface with a multidimensional array fails.

Interface:

public interface I2DShape
{
    int[,] Data { get; }

    int Rows { get; }

    int Columns { get; }
}

Failing code

Mock.Of<I2DShape>();

Constructor on type 'System.Int32[,]' not found.

Workaround

var shapeMock = new Mock<I2DShape>();
shapeMock.SetupGet(x => x.Data).Returns(new int[0, 0]);
@njannink
Copy link
Author

Thanks for implementing this

@stakx
Copy link
Contributor

stakx commented Jun 21, 2017

You're welcome!

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

No branches or pull requests

2 participants