How to mock the below method
jeetendrajaiswal opened this issue · 2 comments
jeetendrajaiswal commented
public class ClassA
{
public string method1()
{
//Some code
}
}
public class ClassB
{
public void method2()
{
ClassA a1 = new ClassA();
string s1 = a1.method1();
}
}
I want to mock method1 so that it returns some specific string data.
vanderkleij commented
How about something like this?
Smock.Run(context =>
{
context.Setup(() => It.IsAny<ClassA>().method1()).Returns("Some value!");
ClassB b = new ClassB();
b.method2();
});
jeetendrajaiswal commented
Thanks :)