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
I need to make a single grain execution unit test.
This one need a specific service in pass by dependency injection in the constructor.
To control my test i need to inject a singleton instance.
I achieved to inject test type using ISiloConfigurator && IHostConfigurator.
Is it possible to inject test instance (Mock) during a test using TestClusterBuilder.
Like :
var def = new Definition() ...
var defintionProviderMock = new Mock<IDefinitionProvider>();
var builder = new TestClusterBuilder();
// Inject defintionProviderMock
var cluster = builder.Build();
cluster.Deploy();
var executor = cluster.GrainFactory.GetGrain<ICustomGrain>(def.Uid);
var result = await executor.RunAsync<string[], string>(s_emailSampleTest);
Check.That(result).IsNotNull().And.ContainsExactly(s_emailA, s_emailB).And.CountIs(2);
cluster.StopAllSilos();
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I need to make a single grain execution unit test.
This one need a specific service in pass by dependency injection in the constructor.
To control my test i need to inject a singleton instance.
I achieved to inject test type using ISiloConfigurator && IHostConfigurator.
Is it possible to inject test instance (Mock) during a test using TestClusterBuilder.
Like :
Beta Was this translation helpful? Give feedback.
All reactions