Reputation: 14195
Inside my test I'm having mock object which should test expected NotImplementedException thrown from MyService.Create method
I'm struggle in this part
var hotelServiceMock = new Mock<HotelService>();
hotelServiceMock.Setup(x=>x.Create(It.IsAny<HotelToCreateDTO>(), true))
.Throws(() => NotImplementedException());
I was think to use Returns instead of thrown (seen somewhere on net for some expected value, not exception) but on intellisense I'm getting only
Upvotes: 0
Views: 66
Reputation: 11273
I haven't used Moq (I should) but from the Intellisense it looks like it should be:
hotelServiceMock.Setup(x=>x.Create(It.IsAny<HotelToCreateDTO>(), true)).Throws<NotImplementedException>()
Upvotes: 1