Created
August 9, 2018 20:59
-
-
Save ChrisMoney/c89ffc4e196cd915587270bb5c0ad555 to your computer and use it in GitHub Desktop.
Unit Test : Test if method was called
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mockTaxDocumentForm = new Mock<TaxDocumentForm>(null, null); | |
mockTaxDocumentForm = GetMockValidTaxDocumentForm(); | |
var calls = 0; | |
var mock = new Mock<ITaxDocumentService>(); | |
mock.Setup(m => m.Process(mockTaxDocumentForm.Object)) | |
.Callback(() => calls++); | |
var methodCall = mock.Object; | |
var result = methodCall; | |
mock.Verify(m => m.Process(mockTaxDocumentForm.Object)); | |
Assert.AreEqual(1, calls); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment