Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.47 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Why isn't there a Times.Always in Moq?
  2. should_only_write_valid_xml_documents
  3.  
  4. Mock.Get(this.writer).Verify(
  5.     w => w.Write(
  6.         It.Is<XDocument>(doc => XsdValidator.IsValid(doc)),
  7.         It.Is<int>(n => n < 3)),
  8.     Times.Always);
  9.        
  10. var mock = new Mock<IFoo>(MockBehavior.Strict);
  11.        
  12. Times.Exactly(calculatedAmount)
  13.        
  14. mock.Verify(x => x.Method(It.Is<int>(i => i == 10)), Times.Always());
  15.        
  16. mock.Verify(x => x.Method(It.Is<int>(i => i != 10)), Times.Never());