0

I want my test to verify that there was no interaction with a dependency not just individual method or property. Is there a way to do that easily?

Found answer here: What is the FakeItEasy equivalent of the Moq VerifyNoOtherCalls() method

epitka
  • 17,275
  • 20
  • 88
  • 141

2 Answers2

2

With FakeItEasy you can create a strict mock for your dependency and not define any methods/properties.

var foo = A.Fake<IFoo>(x => x.Strict());

Any attempts to access foo members will result in an ExpectationException.

Blair Conrad
  • 233,004
  • 25
  • 132
  • 111
Gabriel Negut
  • 13,860
  • 4
  • 38
  • 45
1

Gabriel's answer is fine. Another option, if you prefer to check explicitly, it this:

A.CallTo(theDependency).MustNotHaveHappened();
Thomas Levesque
  • 286,951
  • 70
  • 623
  • 758