Skip to content

Instantly share code, notes, and snippets.

@Tirael
Last active April 24, 2017 11:50
Show Gist options
  • Save Tirael/4c9e3f4470ff601a6b32cc840bc76921 to your computer and use it in GitHub Desktop.
Save Tirael/4c9e3f4470ff601a6b32cc840bc76921 to your computer and use it in GitHub Desktop.
Auto-mocking an IObservable pushes a value
// https://github.com/nsubstitute/NSubstitute/issues/210#issuecomment-158282595
foo.WhenStuffHappened.Returns(Observable.Return(5));
// or
foo.WhenStuffHappened.Returns(Observable.Empty());
// or
foo.WhenStuffHappened.Returns(Observable.Throws(new Exception("Die")));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment