Friday, January 25, 2019

options for Verify in MOQ 4.8.0.0

If you do something like this to verify that the Rollback method on your mock has never been run:

myMock.Verify(x => x.Rollback(), Times.Never);

 
 

Alright, what are the options for Times here? They are:

  1. Times.AtLeast(13)
  2. Times.AtLeastOnce
  3. Times.AtMost(27)
  4. Times.AtMostOnce
  5. Times.Between(42, 69, Range.Inclusive)
  6. Times.Exactly(86)
  7. Times.Never
  8. Times.Once

 
 

.Inclusive here will include the forty-two and the sixty-nine along with forty-three to sixty-eight while .Exclusive would include everything between these two numbers.

No comments:

Post a Comment