public async Task RpcInitializationService_TriggerShutdown() { Mock <IRpcServer> testRpcServer = new Mock <IRpcServer>(); _rpcInitializationService = new RpcInitializationService(_optionsMonitor, new Mock <IEnvironment>().Object, testRpcServer.Object, _mockLanguageWorkerChannelManager.Object, _logger); await _rpcInitializationService.OuterStopAsync(CancellationToken.None); testRpcServer.Verify(a => a.ShutdownAsync(), Times.Once); testRpcServer.Verify(a => a.KillAsync(), Times.Never); }
public async Task RpcInitializationService_TriggerShutdown_KillGetsCalledWhenShutdownThrowsException() { Mock <IRpcServer> testRpcServer = new Mock <IRpcServer>(); testRpcServer.Setup(a => a.ShutdownAsync()).ThrowsAsync(new Exception("Random Exception")); _rpcInitializationService = new RpcInitializationService(_optionsMonitor, new Mock <IEnvironment>().Object, testRpcServer.Object, _mockLanguageWorkerChannelManager.Object, _logger); await _rpcInitializationService.OuterStopAsync(CancellationToken.None); testRpcServer.Verify(a => a.ShutdownAsync(), Times.Once); testRpcServer.Verify(a => a.KillAsync(), Times.Once); }