I suggest you ...

Introduce a MoqException to wrap fex. ArgumentException

I had a Unit Test with following attribute: [ExpectedException(typeof(ArgumentException))]
So the test would succeed when this exception was thrown.

But because I was incorrectly using Moq, my test would always pass. During the Setup() method, Moq was throwing an ArgumentException. Now if incorrect usage (fex using a sealed class to mock, or a property that's not defined as virtual) would throw MoqException, the test would fail, causing me to search for the problem.

4 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    DeefDeef shared this idea  ·   ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • DeefDeef commented  · 

        Great! Moq roqs!

      Feedback and Knowledge Base