Can I write the following assert on the mock object, in a way that it shows "UnBookFlight was not called with proper parameters or not even called" in case the assert fails?
mockBookingService
.AssertWasCalled(ms=>ms.UnBookFlight(Arg<DateTime>.Is.Equal(dummyDate)));
According to this article, you can specify a message in the method options passed to AssertWasCalled()
:
mockBookingService.AssertWasCalled(
ms => ms.UnBookFlight(Arg<DateTime>.Is.Equal(dummyDate)),
options => {
options.Message("UnBookFlight was not called with proper parameters or not even called");
});