public class Class1
{
private bool Helper()
{
return true;
}
public bool TestMe()
{
if (Helper()) return true;
return false;
}
}
[TestMethod]
public void TestMethod1()
{
var class1 = Mock.Create<Class1_Accessor>();
Mock.Arrange(() => class1.Helper()).Returns(false);
Mock.Arrange(() => class1.TestMe()).CallOriginal();
bool actual = class1.TestMe();
Assert.IsFalse(actual);
}
Why is the class1.Helper() mock not mocking, it is executing the method. We have legacy code which has this going on everywhere so I want mock internal calls.
Thanks.
{
private bool Helper()
{
return true;
}
public bool TestMe()
{
if (Helper()) return true;
return false;
}
}
[TestMethod]
public void TestMethod1()
{
var class1 = Mock.Create<Class1_Accessor>();
Mock.Arrange(() => class1.Helper()).Returns(false);
Mock.Arrange(() => class1.TestMe()).CallOriginal();
bool actual = class1.TestMe();
Assert.IsFalse(actual);
}
Why is the class1.Helper() mock not mocking, it is executing the method. We have legacy code which has this going on everywhere so I want mock internal calls.
Thanks.