public async Task ResumeHost_HostNotRunning_ReturnsExpected(ScriptHostState hostStatus, bool drainModeEnabled, int expectedCode) { var scriptHostManagerMock = new Mock <IScriptHostManager>(MockBehavior.Strict); var drainModeManager = new Mock <IDrainModeManager>(MockBehavior.Strict); var serviceProviderMock = scriptHostManagerMock.As <IServiceProvider>(); serviceProviderMock.Setup(x => x.GetService(typeof(IDrainModeManager))).Returns(drainModeManager.Object); scriptHostManagerMock.SetupGet(p => p.State).Returns(hostStatus); drainModeManager.Setup(x => x.IsDrainModeEnabled).Returns(drainModeEnabled); var result = (StatusCodeResult)await _hostController.Resume(scriptHostManagerMock.Object); Assert.Equal(expectedCode, result.StatusCode); scriptHostManagerMock.Verify(p => p.RestartHostAsync(It.IsAny <CancellationToken>()), Times.Never()); }