Skip to content

Instantly share code, notes, and snippets.

@hartbit
Created September 23, 2013 15:05
Show Gist options
  • Save hartbit/6671807 to your computer and use it in GitHub Desktop.
Save hartbit/6671807 to your computer and use it in GitHub Desktop.
[Test]
public void SimpleTest()
{
var calculator = Substitute.For<ICalculator>();
int z;
calculator.Add(1, 2, out z).Returns(x => { x[2] = 2; return 3; });
calculator.Add(4, 5, out z).Returns(x => { x[2] = 20; return 9; });
Expect(calculator.Add(1, 2, out z), Is.EqualTo(3));
Expect(z, Is.EqualTo(2));
Expect(calculator.Add(4, 5, out z), Is.EqualTo(9)); // Expected 9 but was 0
Expect(z, Is.EqualTo(20));
}
@hartbit
Copy link
Author

hartbit commented Sep 23, 2013

Thanks!

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