I'm new to Moq and mocking.
I have a class Car
and I want to Mock this class:
Car car = Mock<Car>();
I'm getting the error "Cannot implicitly convert type 'Moc.Mock' to 'Car'.
It seems I could do this if I had:
Car car = Mock<ICar>();
However I don't actually have a ICar
Can anyone tell me how to achieve the mock of Car
?
var mockCar = Mock<Car>();
// Configure the mock properties and methods.
Car car = mockCar.Object;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With