I have a static method
Public Shared Function UpdateGroup(ByVal details As GroupDetails)
As ControllerResult
Return _methodObject.UpdateGroup(details)
End Function
that was refactored to be able to mock with help of
Private Shared _methodObject As ISecurityController =
New SecurityControllerMethodObject()
Public Shared Sub OverrideInstance(ByVal controller As ISecurityController)
_methodObject = controller
End Sub
Then on my test I have
var moqSecurityController = new Mock<ISecurityController>();
moqSecurityController
.Setup(x => x.UpdateGroup(groupDetails))
.Returns(controllerResult);
SecurityController.OverrideInstance(moqSecurityController.Object);
If I put a breakpoint on that last line I can see that groupDetails have what it should as well as controllerResult, so I would expect that when Function UpdateGroup is called, the controllerResult would be returned, which is just a simple class with a Message & Success properties.
However, what I get is Null/Nothing.
What am I missing?
Note: As you might have noticed, the production code is in VB.NET, my tests are in C#.
Is it because your groupDetails don’t match?
try