public void KCommandShowsErrorWhenGivenSubcommandWasNotFoundInProjectJson(DisposableDir runtimeHomeDir) { var projectStructure = @"{ 'project.json': '{ }' }"; using (runtimeHomeDir) using (var projectPath = TestUtils.CreateTempDir()) { DirTree.CreateFromJson(projectStructure).WriteTo(projectPath); string stdOut, stdErr; var exitCode = KCommandTestUtils.ExecKCommand( runtimeHomeDir, subcommand: "invalid", arguments: string.Empty, stdOut: out stdOut, stdErr: out stdErr, environment: new Dictionary <string, string> { { EnvironmentNames.AppBase, projectPath } }); Assert.NotEqual(0, exitCode); Assert.Contains("Unable to load application or execute command 'invalid'.", stdErr); } }
public void KCommandReturnsZeroExitCodeWhenHelpOptionWasGiven(DisposableDir runtimeHomeDir) { using (runtimeHomeDir) { string stdOut, stdErr; var exitCode = KCommandTestUtils.ExecKCommand( runtimeHomeDir, subcommand: string.Empty, arguments: "--help", stdOut: out stdOut, stdErr: out stdErr); Assert.Equal(0, exitCode); } }
public void KCommandReturnsNonZeroExitCodeWhenNoArgumentWasGiven(DisposableDir kreHomeDir) { using (kreHomeDir) { string stdOut, stdErr; var exitCode = KCommandTestUtils.ExecKCommand( kreHomeDir, subcommand: string.Empty, arguments: string.Empty, stdOut: out stdOut, stdErr: out stdErr); Assert.NotEqual(0, exitCode); } }
public void KCommandShowsVersionAndReturnsZeroExitCodeWhenVersionOptionWasGiven(DisposableDir runtimeHomeDir) { using (runtimeHomeDir) { string stdOut, stdErr; var exitCode = KCommandTestUtils.ExecKCommand( runtimeHomeDir, subcommand: string.Empty, arguments: "--version", stdOut: out stdOut, stdErr: out stdErr); Assert.Equal(0, exitCode); Assert.Contains(TestUtils.GetRuntimeVersion(), stdOut); } }
public void KCommandShowsErrorWhenNoProjectJsonWasFound(DisposableDir runtimeHomeDir) { using (runtimeHomeDir) using (var emptyFolder = TestUtils.CreateTempDir()) { string stdOut, stdErr; var exitCode = KCommandTestUtils.ExecKCommand( runtimeHomeDir, subcommand: "run", arguments: string.Empty, stdOut: out stdOut, stdErr: out stdErr, environment: new Dictionary <string, string> { { EnvironmentNames.AppBase, emptyFolder } }); Assert.NotEqual(0, exitCode); Assert.Contains("Unable to locate project.json", stdErr); } }