Hi,
NCrunch does not give the same coverage metric for the following 2 classes,
although functionally they are identical.
Does Ncrunch coverage work on the code line as in the editor;
or on msil code itself, like ncover does ?
Code:
// Will be 100% coverage
public class CoverageWithoutNewLine
{
public bool Do(bool b)
{
if (b) return true;
return false;
}
}
Code:
// Will be 80% coverage
public class CoverageWithNewLine
{
public bool Do(bool b)
{
if (b)
return true; // not covered
return false;
}
}
The test code to reproduce:
Code:
using NUnit.Framework;
namespace NcrunchCoverage
{
[TestFixture]
public class CoverageTest
{
[Test]
public void WithNewlineTest()
{
CoverageWithNewLine c = new CoverageWithNewLine();
Assert.False(c.Do(false));
}
[Test]
public void NoNewLineTest()
{
CoverageWithoutNewLine c = new CoverageWithoutNewLine();
Assert.False(c.Do(false));
}
}
}