In some cases when you are writing Unit Tests with Moq, you may have to return a null value from your Mocked object.
Unfortunately, if you directly attempt to return null from a Mocked object though, you will receive an error message.
Therefore, how do you return null from a Mocked object?
Well, the answer is deceptively simple! You simply assign a null value to the expected object and simply return that null object as follows:
No comments:
Post a Comment