public void Execute_Returns100_WhenSourceDirIsEmpty() { // Arrange var srcDir = Path.Combine(_testDirPath, "emptydir"); Directory.CreateDirectory(srcDir); var cmd = new BuildpackDetectCommand { SourceDir = srcDir }; // Act & Assert Assert.Equal( BuildpackDetectCommand.DetectorFailCode, cmd.Execute(GetServiceProvider(cmd), new TestConsole())); }
public void Execute_OutputsNode_WhenPackageJsonExists() { // Arrange var srcDir = Path.Combine(_testDirPath, "nodeappdir"); Directory.CreateDirectory(srcDir); File.WriteAllText(Path.Combine(srcDir, NodeConstants.PackageJsonFileName), "\n"); var cmd = new BuildpackDetectCommand { SourceDir = srcDir }; var console = new TestConsole(); // Act int exitCode = cmd.Execute(GetServiceProvider(cmd), console); // Assert Assert.Equal(ProcessConstants.ExitSuccess, exitCode); Assert.Contains( $"{NodeConstants.NodeJsName}=\"{NodeScriptGeneratorOptionsSetup.NodeLtsVersion}\"", console.StdOutput); }
public void Execute_OutputsPhp_WhenComposerFileExists() { // Arrange var srcDir = Path.Combine(_testDirPath, "phpappdir"); Directory.CreateDirectory(srcDir); File.WriteAllText(Path.Combine(srcDir, PhpConstants.ComposerFileName), "\n"); var cmd = new BuildpackDetectCommand { SourceDir = srcDir, PlanPath = Path.Combine(_testDirPath, "plan.toml") }; var console = new TestConsole(); // Act int exitCode = cmd.Execute(GetServiceProvider(cmd), console); // Assert Assert.Equal(ProcessConstants.ExitSuccess, exitCode); Assert.Contains( $"{PhpConstants.PlatformName}=\"{PhpConstants.DefaultPhpRuntimeVersion}\"", console.StdOutput); }