Skip to content

Instantly share code, notes, and snippets.

@GraemeF
Created February 10, 2011 12:25
Show Gist options
  • Select an option

  • Save GraemeF/820437 to your computer and use it in GitHub Desktop.

Select an option

Save GraemeF/820437 to your computer and use it in GitHub Desktop.
How can I check that "_log.Offset = newOffset" happened?
Fake.GetCalls(_log).
Single(call => call.Method.Name == "set_Offset").
GetArgument<TimeSpan>(0).
Should().Equal(newOffset);
@patrik-hagne

Copy link
Copy Markdown

This should do what you want:

NextCall.To(_log).MustHaveHappened(Repeated.Once.Exactly);
_log.Offset = newOffset;

However, I'm slightly opinionated in this case and I would argue that in general it would be better to just check the value of the property (in NUnit):

Assert.That(_log.Offset, Is.EqualTo(newOffset));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment