From my point of view, Mocking should be used to model some kind of behavior on which we depend, but do not test. Consequently:
Q: Did I miss something? - No, you did not miss anything, the MOQ lacks the ability to imitate personal behavior.
Q: Can you test internal methods using Moq? - If the result of private behavior is visible in public, then yes, you can test the internal method, but this is not because of Moq, which you can check. I would like to emphasize that Mock is not the ability to test, but rather the ability to such behavior, which we do not test, but depend on it.
C: The main advantage of TDD is that your code becomes easy to change. If you start testing internal components, then the code becomes tough and difficult to change - I disagree with this comment for two main reasons: 1: This is not an innovative fallacy, since TDD is not just the ability to code faster, but also better quality code. Therefore, the more tests we can do, the better. 2: This does not make the code more difficult to change if you can somehow check the internal methods.
user1840652
source share