Im trying to do this test method.
[TestMethod]
public void Ao_Ler_Stream_Com_1_Linha_Deve_Ler_1_Linha()
{
var ms = new MemoryStream();
var persistidor = new Mock<IPersistidor>().Object;
var importadorMock = new Mock<Importador>(ms, null, persistidor);
importadorMock.Object.Processar();
importadorMock.Verify(imp => imp.Persistidor.Persistir(It.IsAny<string>()), Times.Exactly(1));
}
But the method is throwing this exception:
Test method TestProject.Dado_Um_Importador_Qualquer.Ao_Ler_Stream_Com_1_Linha_Deve_Ler_1_Linha threw exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Invalid setup on a non-overridable member:
mock => mock.Persistidor.
Why it is happening ? IPersistidor is an interface so it can not be defined as virtual
--
Abraços,
Diogo Menezes
http://dmenezes.com.br
http://twitter.com/diogolmenezes