Created
April 24, 2014 12:25
-
-
Save blairconrad/11252832 to your computer and use it in GitHub Desktop.
Showing how to set the return value for method. For http://stackoverflow.com/questions/23267993/fakeiteasy-does-not-allow-to-setup-value-to-return
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SomeClass | |
{ | |
public virtual int Method(int arg1, int arg2) | |
{ | |
return 7; | |
} | |
} | |
[TestFixture] | |
public class TestFixture | |
{ | |
[Test] | |
public void Should_be_able_to_set_return_value() | |
{ | |
const int param1 = 9; | |
var fakeInstanse = A.Fake<SomeClass>(); | |
A.CallTo(() => fakeInstanse.Method(param1, param1)) | |
.Returns(8); | |
Assert.That(fakeInstanse.Method(param1, param1), Is.EqualTo(8)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment