I have a dependency that gets called when the object I'm testing is created. However, it should never be called after that. How would I write such a test?
I'd like just this line as my test (since I'm trying to follow the AAA style of test writing). However, this assertion will fail since the Publish
method was called during setup.
Notifier.AssertWasNotCalled(Sub(n) n.Publish(Arg(Of Message).Is.Anything))
Is there a way to "reset" the calls on the dependency I've mocked?
Note: I can set it up so that I check the property on the Message
argument for a value I expect after initialization, but that makes my test more fragile/brittle and I'd like to avoid it if possible.
_notifier.AssertWasNotCalled(
Sub(n) n.Publish(Arg(Of Message).Matches(Function(m) m.property = "yo!")))