3
I need to cover for the method example below:
public int GetQtdCart()
{
int qtCart = 0;
using (var db = new SfrEntities())
{
qtCarteira = db.Set<Contract>().Select(x => x.Cart).Distinct().Count();
}
return qtCart;
}
I created a test layer and applied the references NUnit
and Pex.Microsoft.Framework
.
I created the test below that is successful but the coverage is zero:
public void TestarGetQtdCart()
{
Mock<IContratoRepository> mock = new Mock<IContratoRepository>();
mock.Setup(m => m.GetQtdCart()).Returns(contrato.Carteira);
var resultadoEsperado = mock.Object.GetQtdCart();
var resultado = 0;
Assert.AreEqual(resultado, resultadoEsperado);
}
this is the site of the OS in Portuguese, translate your question
– Ricardo Pontual
Coverage is zero because it doesn’t test the Getqtdcart method().
– ramaral