예제 #1
0
        protected async Task VerifyHeaders(string commandText, string baseAddress, string path, int expectedResponseLines, string expectedHeader)
        {
            MockedShellState shellState = new MockedShellState();

            HttpState httpState = GetHttpState(baseAddress, path);

            ICoreParseResult parseResult = CoreParseResultHelper.Create(commandText);

            await _command.ExecuteAsync(shellState, httpState, parseResult, CancellationToken.None);

            Assert.Equal(expectedResponseLines, shellState.Output.Count);
            Assert.Equal(expectedHeader, shellState.Output[expectedResponseLines - 2]);
        }
예제 #2
0
        protected async Task VerifyErrorMessage(string commandText, string baseAddress, string path, string expectedErrorMessage)
        {
            HttpState httpState = GetHttpState(baseAddress, path);

            expectedErrorMessage = expectedErrorMessage.SetColor(httpState.ErrorColor);

            MockedShellState shellState = new MockedShellState();

            ICoreParseResult parseResult = CoreParseResultHelper.Create(commandText);

            await _command.ExecuteAsync(shellState, httpState, parseResult, CancellationToken.None);

            Assert.Equal(expectedErrorMessage, shellState.ErrorMessage);
        }