Good afternoon
I have a class and it has an associated extension method.
public class Person{
public int ID {get;set}
public string Name {get;set}
}
Extension method:
public static class Helper {
public static int GetToken(this Person person){
int id = 0;
//Something here is done to read token from another service...
return id;
}
}
Now I am trying to use Rhino and test this method
public void readPersonToken(int personId) {
var person = Person.GetPersonInfo(personId);//we consume a service here
Console.Writeline(person.GetToken());//get token is consuming another service
}
Supposing I am writing my test and have already an interface that calls GetPersonInfo()
var _interface = MockRepository.GenerateMock<IMyInterface>();
and the main Expect is
_interface.Expect(x => x.GetPersonInfo(2))
.Return(new Person { ID=2, Name = "A Stubbed Monica!" });
how can I create a test for the extension metod GetToken?