Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 1
    In fact I'm writing the tests prior to the code but I just stumbled into this question while doing so. My issue of how to check if the validator is called with the right parameters since this is happening inside the method that I'm testing. Commented Apr 19, 2016 at 15:01
  • Then only pay attention to the first paragraph of my answer. Are you familiar with the concept of mock objects? Commented Apr 19, 2016 at 15:05
  • You can validate calls to the faked object using fakeiteasy. A.CallTo(() => fakedObject.SomeMethod()).MustHaveHappened(Repeated.Exactly.Once); Commented Apr 19, 2016 at 15:13
  • @fschmengler as far as I know using a mock will only validate that the class is referenced somehow, am I correct? Commented Apr 20, 2016 at 7:09
  • No, mock objects should be able to verify exactly which methods are called with which parameters. Commented Apr 20, 2016 at 7:15