9
How to test private methods using Microsoft.VisualStudio.Testtools.Unittesting and Moq
My test class is like this:
[TestClass]
public class ClasseDeTeste
{
private MinhaClasseComMetodosPrivados _minhaClasseComMetodosPrivados;
[TestInitialize]
public void Initialize()
{
...inicialização de diversos repositórios
_minhaClasseComMetodosPrivados = new MinhaClasseComMetodosPrivados(parametros, ...);
}
[TestMethod]
public void TestarFuncaoPrivadaXXX()
{
var result = _minhaClasseComMetodosPrivados.metodoPrivado(param1, param2, param3);
Assert.AreEqual("retorno esperado ",result);
}
}
Does any of the answers meet the request? Does it need to be improved?
– Jéf Bueno
In case I think you should accept the LINQ which is what you really wanted to know, mine is complement.
– Maniero