c# - Mock a method for test - Stack Overflow
stackoverflow.com › questions › 36345282Apr 4, 2016 · 21 Trying to mock a method that is called within another method. // code part public virtual bool hello (string name, int age) { string lastName = GetLastName (); } public virtual string GetLastName () { return "xxx"; } // unit test part Mock<Program> p = new Mock<Program> (); p.Setup (x => x.GetLastName ()).Returns ("qqq");