I have this test
[Test]
public void SaveInventoryItemLoad_Will_Call_WCF_Service_SaveInventoryItemLoad()
{
adapter.SaveInventoryItemLoad(new List<InventoryItemLoadProxy>());
itemMasterBusinessClientMock.Verify(x => x.SaveInventoryItemLoad(It.IsAny<List<InventoryItemLoadProxy>>()), Times.Once());
}
It was fine because I had tested on the WCF side the the method did what I wanted it to so all I needed was to say “Hey did you call the service? Yeah!”. Now though… I need to break up said list in to chucks of 10 or less i.e. a list of 23 items would be three lists of 10, 10 and then 3. So step one is of course to write a unit test to verify that I haven’t pushed more than ten items to the SaveInventoryItemLoad method. I can of course verify that method was called X amount of times but that isn’t what I want. I want to make sure that the list supplied to the method was <= 10 but I can’t seem to figure out how. I trolled the moq quickstart but don’t see how I would do that.
I though this would do it somehow
// Verify setter with an argument matcher
mock.VerifySet(foo => foo.Value = It.IsInRange(1, 5, Range.Inclusive));
But I can’t seem to make that work. I guess I have never run into this before. Anyone know how to do this?
Thanks
Here is the code:
Here are few examples.