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

Cannot cast inside the Action<T> parameter of Verify method #1438

Open
SparrowWithBrokenWing opened this issue Nov 4, 2023 · 0 comments
Open
Labels

Comments

@SparrowWithBrokenWing
Copy link

I met an exception when trying to run the test that have the following code. When I try to make an expression that using a cast, this exception was throw by Moq: "System.ArgumentException : Unsupported expression: (IObserver)player". Why Moq don't allow to cast in this situation? Or I'm writing the test code in wrong way?

collectionOfMockForPlayer[1]
    .Verify((IPlayer player) => ((IObserver<IMove>)player).OnError(It.IsAny<MatchManager.IllegalMoveException>()), Times.Once());```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant