You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a mocked interface is passed as an argument and a generic method is invoked, the Verify call does not recognize the correct type arguments if a subclass is supplied as the type argument. The Verify call successfully recognizes the subclass type argument if the mock is invoked directly rather than in a supporting method.
The expected behaviour is that the 3 tests below pass. The actual behaviour is that only the first test passes. All 3 tests can be made to pass by changing the type argument in Verify to the base class rather than the subclass:
Note the downcast (Message). This is what your Raiser classes do. Because of it, you're calling the method Dispatch<Message>. However, you are in effect verifying a different method, namely Dispatch<ConcreteMessage>, due to type inference from It.IsAny<ConcreteMessage>().
Beyond this suggestion, I haven't really thought about what can or should be done to support your scenario. Do you (or anyone else) feel we should follow this up any further? If not, I will close this issue in approx. 2 or 3 weeks.
When a mocked interface is passed as an argument and a generic method is invoked, the Verify call does not recognize the correct type arguments if a subclass is supplied as the type argument. The Verify call successfully recognizes the subclass type argument if the mock is invoked directly rather than in a supporting method.
The expected behaviour is that the 3 tests below pass. The actual behaviour is that only the first test passes. All 3 tests can be made to pass by changing the type argument in Verify to the base class rather than the subclass:
but in the final 2 tests, the Verify calls fail to match the subclass type for the generic method invocation.
The text was updated successfully, but these errors were encountered: