I have the following concrete code:
var allBookedPos = await _dataService.GetAllBookingsForVendorInAwitingApproval(purchaseOrder.VendorCode);
foreach (var booking in allBookedPos)
{
// get the purchase order
var po = await _purchaseOrderDataService.GetPurchaseOrderOnlyByIdAsync(booking.PurchaseOrderId);
}
I've set my first mock to populate allBookedPos
with:
BookingDataAccessMock.Setup(x => x.GetAllBookingsForVendorInAwitingApproval("A1248").Result).Returns(viewBookings);
This holds 2 records.
I'm now trying to mock the GetPurchaseOrderOnlyByIdAsync
method, where the value passed in is a GUID.
Because I essentially want this method called twice I thought I'd be able to use setupSequence
in the form:
PurchaseOrderDataMock.SetupSequence(X => X.GetPurchaseOrderByIdAsync(It.IsAny<Guid>)).Returns().Returns()
Where I populate each return with the values that I expect returned for each item. However, I get an error on It.IsAny<Guid>
:
Argument 1 cannot convert from method group to system.Guid
It.IsAny
is a method. You must invoke the method to get a new matcher instance:
It.IsAny<Guid>()