Oliver Abt

My feedback

  1. 1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    2 comments  ·  Feature Requests  ·  Flag idea as inappropriate…  ·  Admin →

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    An error occurred while saving the comment
    Oliver Abt commented  · 

    This is about unit tests in the form:

    [TestMethod, ExpectedException(typeof(InvalidOperationException)]
    public void InvalidOperaionTest()
    {
    MethodUnderTest(); // should throw the exception in the current state

    // lines after that point can not be reached on a successfull test
    // with the current behaviour of NCrunch this line would be marked as uncovered
    // something like the following should suppress this:

    // ncrunch: no coverage next
    }

    It looks like this is negligible because per such a test there is only one line of uncovered code, but source files wich are not at 100% coverage make me recheck them ever and ever again.

    I'm aware that I could write my test like that:

    [TestMethod]
    public void InvalidOperaionTest()
    {
    InvalidOperationException expectedException = null;
    try
    {
    MethodUnderTest(); // should throw the exception in the current state

    } // ncrunch: no coverage
    catch(InvalidOperationException ex)
    {
    expectedException = ex;
    }

    Assert.IsNotNull(expectedException);
    }

    but this looks very bloated to me.

    Oliver Abt shared this idea  · 
  2. 58 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    under review  ·  2 comments  ·  Feature Requests  ·  Flag idea as inappropriate…  ·  Admin →

    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
    Oliver Abt supported this idea  · 

Feedback and Knowledge Base