You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it's not possible to mock generated grain clients because their generated methods are not virtual. For better testability could you consider making them virtual or better additionally generating interfaces for them? For an example, I want to unit test a class which needs to call some grain. Currently I can't test it in isolation because I need to pass an instance of that grain client and that instance can't be mocked.
class SomeClass
{
private readonly Func<string, MyGrainClient> _grainFactory;
public SomeClass(Func<string, MyGrainClient> grainFactory) // But MyGrainClient can't be mocked!
{
_grainFactory = grainFactory;
}
public void SomeMethod(string arg) // I want to test this method without real MyGrainClient
{
_grainFactory(arg).MyMethod();
}
}
The text was updated successfully, but these errors were encountered:
Currently it's not possible to mock generated grain clients because their generated methods are not virtual. For better testability could you consider making them virtual or better additionally generating interfaces for them? For an example, I want to unit test a class which needs to call some grain. Currently I can't test it in isolation because I need to pass an instance of that grain client and that instance can't be mocked.
The text was updated successfully, but these errors were encountered: