Hello , This is my first query. I am facing the problem of faking instance.
I have a public method. I want to fake it. I have created the fake object stil it does not work. Please see the code.
--Class Code---
public class Class1
{
public string GetData(string filter)
{
if (filter == "1")
return "1111";
else
return "2222";
}
}
--Class Code---
-----CODE------
[TestMethod(), Isolated]
TESTMETHOD
{
//arrange
Class1 obj = Isolate.Fake.Instance<Class1>();
Isolate.WhenCalled(() => obj.GetData("1")).WillReturn("1111");
//act
actual = target.Index() as ViewResult;
//assert
Isolate.Verify.WasCalledWithAnyArguments(() => obj.GetData("2"));
}
-----CODE------
Verify fails here. That means tough i have mocked it , it is calling real method.
HOw do I solve this?