Hi All, I am new to mocking, and have started with Rhino Mocks. My scenario is like this..in my class library i have a public function and inside it i have a private function call, which gets output from a service.I want to remove the private function dependency.
public class Employee
{
public virtual string GetFullName(string firstName, string lastName)
{
string middleName = GetMiddleName();
return string.Format("{0} {2} {1}", firstName, lastName,middleName );
}
private virtual string GetMiddleName()
{
// Some call to Service
return "George";
}
}
This is not my real scenario though, i just wanted to know how to remove dependency of GetMiddleName() function and i need to return some default value while unit testing.
Note : I won't be able to change the private function here..or include Interface..Keeping the functions as such, is there any way to mock this.Thank