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
I try to return a Result.Created(Result.Success()) via a ReturnsAsync with Moq as follows:
var r2 = Result.Created(Result.Success());
_mockService2
.Setup(x => x.SyncAsync(It.IsAny<Company>(), It.IsAny<Contact>()))
.ReturnsAsync(r2);
But when the Mock is executed in the system under test then the Value of r2 is returned. So in this case the Mocked object is returning Result.Success().
To make it clear, if I would change r2 to Result.Created(null), then a null value is returned.
Hello,
I try to return a
Result.Created(Result.Success())
via a ReturnsAsync with Moq as follows:But when the Mock is executed in the system under test then the Value of
r2
is returned. So in this case the Mocked object is returning Result.Success().To make it clear, if I would change r2 to
Result.Created(null)
, then a null value is returned.On the otherhand,
works like a charm. Then the Result.Error is nicely returned by the Mocked object.
I have some feeling that the implicit operators are at work with this problem but I cannot put the finger on it...
Please let me know if you need some extra clarification.
The text was updated successfully, but these errors were encountered: