Mock a method for test
Trying to mock a method that is called within another method. public virtual bool hello(string name, int age) { string lastName = GetLastName(); } public virtual string GetLastName() { return "xxx"; } Mock<program> name= new Mock<program>(); name.Setup(x => x.GetLastName()).Returns("qqq"); I want the method GetLastName to always return "qqq". Kritner This should work, assuming those are the full method implementations public class MyProgram { public bool hello(string name, int age) { string lastName = GetLastName(); return string.Format("hello {0}", lastName); } public virtual string