public void ShouldSetWorkingDirectoryToBinaryPathIfNoOutputDirectorySpecified() { // Given const string Expected = "/Working/bin"; var fixture = new CMakeBuildRunnerFixture(); // When var result = fixture.Run(); // Then Assert.Equal(Expected, result.Process.WorkingDirectory.FullPath); }
public void ShouldAppendBinaryDirectoryToArguments() { // Given const string Expected = "--build \"/Working/bin\""; var fixture = new CMakeBuildRunnerFixture(); // When var result = fixture.Run(); // Then Assert.Equal(Expected, result.Args); }
public void ShouldLookInProgramFiles() { // Given var fixture = new CMakeBuildRunnerFixture(defaultToolExist: false); const string Expected = "/ProgramFilesX86/cmake/bin/cmake.exe"; fixture.FileSystem.CreateFile(Expected); fixture.Environment.SetSpecialPath(SpecialPath.ProgramFilesX86, "/ProgramFilesX86"); // When var result = fixture.Run(); // Then Assert.Equal(Expected, result.Path.FullPath); }
public void ShouldThrowIfSettingsAreNull() { // Given var fixture = new CMakeBuildRunnerFixture { Settings = null }; // When var result = Record.Exception(() => fixture.Run()); // Then Assert.NotNull(result); Assert.IsType <ArgumentNullException>(result); Assert.Equal("settings", ((ArgumentNullException)result).ParamName); }
public void ShouldUseCMakeExecutableFromToolPathIfProvided(string toolPath, string expected) { // Given var fixture = new CMakeBuildRunnerFixture(toolPath: expected) { Settings = { ToolPath = toolPath } }; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Path.FullPath); }
public void ShouldAppendOptionsSeparatedByDash() { // Given const string Expected = "--build \"/Working/bin\" -- \"/m:4\""; var fixture = new CMakeBuildRunnerFixture { Settings = { Options = new [] { "/m:4" } } }; // When var result = fixture.Run(); // Then Assert.Equal(Expected, result.Args); }
public void ShouldAppendConfigurationToArguments() { // Given const string Expected = "--build \"/Working/bin\" --config Debug"; var fixture = new CMakeBuildRunnerFixture { Settings = { Configuration = "Debug" } }; // When var result = fixture.Run(); // Then Assert.Equal(Expected, result.Args); }
public void ShouldAppendTargetsToArguments() { // Given const string Expected = "--build \"/Working/bin\" --target Debug,Release"; var fixture = new CMakeBuildRunnerFixture { Settings = { Targets = new [] { "Debug", "Release" } } }; // When var result = fixture.Run(); // Then Assert.Equal(Expected, result.Args); }
public void ShouldAppendCleanFirstToArguments() { // Given const string Expected = "--build \"/Working/bin\" --clean-first"; var fixture = new CMakeBuildRunnerFixture { Settings = { CleanFirst = true } }; // When var result = fixture.Run(); // Then Assert.Equal(Expected, result.Args); }
public void ShouldSetWorkingDirectoryToBinaryPathIfSet() { // Given const string Expected = "/Working/build"; var fixture = new CMakeBuildRunnerFixture { Settings = { BinaryPath = "./build" } }; // When var result = fixture.Run(); // Then Assert.Equal(Expected, result.Process.WorkingDirectory.FullPath); }
public void ShouldThrowIfBinaryPathIsNull() { // Given var fixture = new CMakeBuildRunnerFixture { Settings = { BinaryPath = null } }; // When var result = Record.Exception(() => fixture.Run()); // Then Assert.NotNull(result); Assert.IsType <ArgumentNullException>(result); Assert.Equal(nameof(CMakeBuildSettings.BinaryPath), ((ArgumentException)result).ParamName); }