private async Task MergeGrainResolverTestsImpl <T>(Type defaultPlacementStrategy, bool restartClient, Func <IGrain, Task> func, params Type[] blackListedTypes) where T : IGrainWithIntegerKey { SetupAndDeployCluster(defaultPlacementStrategy, blackListedTypes); var delayTimeout = RefreshInterval.Add(RefreshInterval); // Should fail var exception = Assert.Throws <ArgumentException>(() => this.cluster.GrainFactory.GetGrain <T>(0)); Assert.Contains("Cannot find an implementation class for grain interface", exception.Message); // Start a new silo with TestGrain await cluster.StartAdditionalSiloAsync(); await Task.Delay(delayTimeout); if (restartClient) { // Disconnect/Reconnect the client await cluster.Client.Close(); cluster.Client.Dispose(); cluster.InitializeClient(); } else { await Task.Delay(ClientRefreshDelay.Multiply(3)); } for (var i = 0; i < 5; i++) { // Success var g = this.cluster.GrainFactory.GetGrain <T>(i); await func(g); } // Stop the latest silos await cluster.StopSecondarySilosAsync(); await Task.Delay(delayTimeout); if (restartClient) { // Disconnect/Reconnect the client await cluster.Client.Close(); cluster.Client.Dispose(); cluster.InitializeClient(); } else { await Task.Delay(ClientRefreshDelay.Multiply(3)); } // Should fail exception = Assert.Throws <ArgumentException>(() => this.cluster.GrainFactory.GetGrain <T>(0)); Assert.Contains("Cannot find an implementation class for grain interface", exception.Message); }