I have an instantiation in constructor in test:
public class Car{
public string Method()
{
return "test";
}
}
private readonly ICar _classUnderTest;
public CarTests()
{
var collaboratingClass = new CollaboratingClass();
_classUnderTest = new Car(collaboratingClass );
}
If I use moq and pass mock instance like this:
var collaboratingClass = new Mock<ICollaboratingClass>();
_classUnderTest = new Car(collaboratingClass .Object);
...then I can't call method. The method from this mocked instance is not being called, so I can't use it for calculation. How can I make my mock object to be able to access method and do operation with mock object?
As you can see I don't want to have concrete dependencies here.