public async Task ExecuteAsync_Always_IsExitingIsTrue() { ArrangeInputs("exit", out MockedShellState shellState, out HttpState httpState, out ICoreParseResult parseResult); ExitCommand exitCommand = new ExitCommand(); await exitCommand.ExecuteAsync(shellState, httpState, parseResult, CancellationToken.None); Assert.True(shellState.IsExiting); }
public async Task ExecuteAsync_Always_DoesNotWritePrompt() { ArrangeInputs("exit", out MockedShellState shellState, out HttpState httpState, out ICoreParseResult parseResult); ExitCommand exitCommand = new ExitCommand(); await exitCommand.ExecuteAsync(shellState, httpState, parseResult, CancellationToken.None); Assert.Empty(shellState.Output); }
public async Task ExitCommandExits() { using var mock = AutoMock.GetLoose(); var context = mock.Mock <IUpgradeContext>().Object; var exitCalled = false; var command = new ExitCommand(() => exitCalled = true); Assert.Equal("Exit", command.CommandText); Assert.False(exitCalled); Assert.True(await command.ExecuteAsync(context, CancellationToken.None).ConfigureAwait(false)); Assert.True(exitCalled); }