开发者

Moq mocking a class

I'm new to Moq and mocking.

I have a class Car and I want to Mock this class:

Car car = Mock<Car>();
开发者_如何学Python

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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜