public async Task SetState_Succeeds(string desiredState, ScriptHostState currentState, HttpStatusCode statusCode) { _mockScriptHostManager.SetupGet(p => p.State).Returns(currentState); var result = await _hostController.SetState(desiredState); var resultStatus = HttpStatusCode.InternalServerError; if (result is StatusCodeResult) { resultStatus = (HttpStatusCode)((StatusCodeResult)result).StatusCode; } else if (result is ObjectResult) { resultStatus = (HttpStatusCode)((ObjectResult)result).StatusCode; } else { Assert.True(false); } Assert.Equal(statusCode, resultStatus); bool fileExists = File.Exists(_appOfflineFilePath); if (string.Compare("offline", desiredState) == 0 && currentState != ScriptHostState.Offline) { // verify file was created Assert.True(fileExists); } else { // verify file does not exist Assert.False(fileExists); } }