Posted By

heathbo on 07/16/14


Tagged

Moq c#


Versions (?)

Moq: Verify a Method is Called


 / Published in: C#
 

The code to verify that a method was called. The this.mockProvider.Verify verifies that GetBiAutoProcessConfigByKeys is called.

  1. [TestMethod]
  2. public void GetProcessConfigSettingsByKeys_Test()
  3. {
  4. // Setup
  5. this.mockProvider.Setup(x => x.GetBiAutoProcessConfigByKeys(123, 456, It.IsAny<int>()))
  6. .Returns(automationConfigurationSetting)
  7. .Verifiable();
  8.  
  9. // Action
  10. var result = target.GetProcessConfigSettingsByKeys(123, 456, null);
  11.  
  12.  
  13. // Assert
  14. this.mockProvider.Verify(x => x.GetBiAutoProcessConfigByKeys(123, 456, null));
  15.  
  16.  
  17. }

Report this snippet  

You need to login to post a comment.