I use the Code Analysis tool in Visual Studio 2012. The report seems very pedantic about what is covered, and I have no idea what else can be done to provide more coverage.
The code I'm testing is as follows:
public class Factory<T> : IFactory<T> where T : new()
{
public T Create()
{
return new T();
}
}
Unit tests:
using System;
using Xunit;
public class Factory_Tests
{
[Fact]
public void Constructor_Works()
{
var target = new Factory<Exception>();
}
[Fact]
public void Create_ReturnsNewValue()
{
var target = new Factory<Exception>();
var actual = target.Create();
Assert.NotNull(actual);
}
}
The report states that the above line has only partial coverage. What I could not verify on this line?
source
share