TypeMock is very powerful. I think he can do it. For other layouts like Moq or Rhino, you will need to use a different strategy.
Strategy for rhino or moka:
As an example: you use the Asssembly class to get the fully qualified name of the assembly.
public class YourClass
{
public string GetFullName()
{
Assembly ass = Assembly.GetExecutingAssembly();
return ass.FullName;
}
}
Assembly, _Assembly. , Assembly . .
:
public class YourClass
{
private _Assembly _assbl;
public YourClass(_Assembly assbl)
{
_assbl = assbl;
}
public string GetFullName()
{
return _assbl.FullName;
}
}
_Assembly:
public void TestDoSomething()
{
var assbl = MockRepository.GenerateStub<_Assembly>();
YourClass yc = new YourClass(assbl);
string fullName = yc.GetFullName();
}