public void Should_Append_Source_Directory_To_Arguments() { // Given const string expected = "\"/Working/source\""; var fixture = new CMakeRunnerFixture(); // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void ShouldSetWorkingDirectoryToSourcePathIfNoOutputDirectorySpecified() { // Given const string Expected = "/Working/source"; var fixture = new CMakeRunnerFixture(); // When var result = fixture.Run(); // Then Assert.Equal(Expected, result.Process.WorkingDirectory.FullPath); }
public void Should_Set_Working_Directory_To_Source_Path_If_No_Output_Directory_Specified() { // Given const string expected = "/Working/source"; var fixture = new CMakeRunnerFixture(); // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Process.WorkingDirectory.FullPath); }
public void ShouldAppendSourceDirectoryToArguments() { // Given const string Expected = "-S \"/Working/source\""; var fixture = new CMakeRunnerFixture(); // When var result = fixture.Run(); // Then Assert.Equal(Expected, result.Args); }
public void Should_Use_CMake_Executable_From_Tool_Path_If_Provided(string toolPath, string expected) { // Given var fixture = new CMakeRunnerFixture(toolPath: expected); fixture.Settings.ToolPath = toolPath; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Path.FullPath); }
public void Should_Set_Working_Directory_To_Output_Path_If_Set() { // Given const string expected = "/Working/build"; var fixture = new CMakeRunnerFixture(); fixture.Settings.OutputPath = "./build"; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Process.WorkingDirectory.FullPath); }
public void Should_Set_Working_Directory_To_Source_Path_If_No_Output_Directory_Specified() { // Given var fixture = new CMakeRunnerFixture(); // When fixture.Run(); // Then fixture.ProcessRunner.Received(1).Start( Arg.Any <FilePath>(), Arg.Is <ProcessSettings>( p => p.WorkingDirectory.FullPath == "/Working/source")); }
public void Should_Append_Toolset_To_Arguments() { // Given const string expected = "\"/Working/source\" -T \"cool_toolset\""; var fixture = new CMakeRunnerFixture(); fixture.Settings.Toolset = "cool_toolset"; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void Should_Append_Source_Directory_To_Arguments() { // Given var fixture = new CMakeRunnerFixture(); // When fixture.Run(); // Then fixture.ProcessRunner.Received(1).Start( Arg.Any <FilePath>(), Arg.Is <ProcessSettings>( p => p.Arguments.Render() == "\"/Working/source\"")); }
public void Should_Append_Platform_To_Arguments() { // Given const string expected = "\"/Working/source\" -A \"x64\""; var fixture = new CMakeRunnerFixture(); fixture.Settings.Platform = "x64"; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void Should_Use_CMake_Executable_From_Tool_Path_If_Provided(string toolPath, string expected) { // Given var fixture = new CMakeRunnerFixture(toolPath: expected); fixture.Settings.ToolPath = toolPath; // When fixture.Run(); // Then fixture.ProcessRunner.Received(1).Start( Arg.Is <FilePath>(p => p.FullPath == expected), Arg.Any <ProcessSettings>()); }
public void Should_Throw_If_Source_Path_Is_Null() { // Given var fixture = new CMakeRunnerFixture(); fixture.SourcePath = null; // When var result = Record.Exception(() => fixture.Run()); // Then Assert.NotNull(result); Assert.IsType <ArgumentNullException>(result); Assert.Equal("sourcePath", ((ArgumentNullException)result).ParamName); }
public void Should_Throw_If_File_System_Is_Null() { // Given var fixture = new CMakeRunnerFixture(); fixture.FileSystem = null; // When var result = Record.Exception(() => fixture.Run()); // Then Assert.NotNull(result); Assert.IsType <ArgumentNullException>(result); Assert.Equal("fileSystem", ((ArgumentNullException)result).ParamName); }
public void ShouldLookInProgramFiles() { // Given var fixture = new CMakeRunnerFixture(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 Should_Set_Working_Directory_To_Output_Path_If_Set() { // Given var fixture = new CMakeRunnerFixture(); fixture.Settings.OutputPath = "./build"; // When fixture.Run(); // Then fixture.ProcessRunner.Received(1).Start( Arg.Any <FilePath>(), Arg.Is <ProcessSettings>( p => p.WorkingDirectory.FullPath == "/Working/build")); }
public void Should_Throw_If_Globber_Is_Null() { // Given var fixture = new CMakeRunnerFixture { }; fixture.Tools = null; // When var result = Record.Exception(() => fixture.Run()); // Then Assert.NotNull(result); Assert.IsType <ArgumentNullException>(result); Assert.Equal("globber", ((ArgumentNullException)result).ParamName); }
public void Should_Append_Options_To_Arguments() { // Given const string expected = "\"/Working/source\" \"-DCMAKE_IS_COOL\" \"-DCAKE_IS_COOL\""; var fixture = new CMakeRunnerFixture(); fixture.Settings.Options = new List <string> { "-DCMAKE_IS_COOL", "-DCAKE_IS_COOL" }; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void Should_Append_Toolset_To_Arguments() { // Given var fixture = new CMakeRunnerFixture(); fixture.Settings.Toolset = "cool_toolset"; // When fixture.Run(); // Then fixture.ProcessRunner.Received(1).Start( Arg.Any <FilePath>(), Arg.Is <ProcessSettings>( p => p.Arguments.Render() == "\"/Working/source\" -T \"cool_toolset\"")); }
public void ShouldThrowIfProcessRunnerIsNull() { // Given var fixture = new CMakeRunnerFixture { ProcessRunner = null }; // When var result = Record.Exception(() => fixture.Run()); // Then Assert.NotNull(result); Assert.IsType <ArgumentNullException>(result); Assert.Equal("processRunner", ((ArgumentNullException)result).ParamName); }
public void ShouldUseCMakeExecutableFromToolPathIfProvided(string toolPath, string expected) { // Given var fixture = new CMakeRunnerFixture(toolPath: expected) { Settings = { ToolPath = toolPath } }; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Path.FullPath); }
public void ShouldNotThrowIfSourcePathIsNull() { // Given var fixture = new CMakeRunnerFixture { Settings = { SourcePath = null, OutputPath = "./build" } }; // When var result = Record.Exception(() => fixture.Run()); // Then Assert.Null(result); }
public void ShouldAppendPlatformToArguments() { // Given const string Expected = "-S \"/Working/source\" -A \"x64\""; var fixture = new CMakeRunnerFixture { Settings = { Platform = "x64" } }; // When var result = fixture.Run(); // Then Assert.Equal(Expected, result.Args); }
public void ShouldAppendToolsetToArguments() { // Given const string Expected = "-S \"/Working/source\" -T \"cool_toolset\""; var fixture = new CMakeRunnerFixture { Settings = { Toolset = "cool_toolset" } }; // When var result = fixture.Run(); // Then Assert.Equal(Expected, result.Args); }
public void ShouldAppendGeneratorToArguments() { // Given const string Expected = "-S \"/Working/source\" -G \"cool_generator\""; var fixture = new CMakeRunnerFixture { Settings = { Generator = "cool_generator" } }; // When var result = fixture.Run(); // Then Assert.Equal(Expected, result.Args); }
public void ShouldSetWorkingDirectoryToOutputPathIfSet() { // Given const string Expected = "/Working/build"; var fixture = new CMakeRunnerFixture { Settings = { OutputPath = "./build" } }; // When var result = fixture.Run(); // Then Assert.Equal(Expected, result.Process.WorkingDirectory.FullPath); }
public void Should_Look_In_Program_Files() { // Given var fixture = new CMakeRunnerFixture(defaultToolExist: false); fixture.FileSystem.Exist( Arg.Is <FilePath>(p => p.FullPath == "/ProgramFilesX86/cmake/bin/cmake.exe")).Returns(true); fixture.Environment.GetSpecialPath( Arg.Is <SpecialPath>(p => p == SpecialPath.ProgramFilesX86)).Returns(info => "/ProgramFilesX86"); // When fixture.Run(); // Then fixture.ProcessRunner.Received(1).Start( Arg.Is <FilePath>(p => p.FullPath == "/ProgramFilesX86/cmake/bin/cmake.exe"), Arg.Any <ProcessSettings>()); }
public void ShouldThrowIfSourcePathAndOutputPathIsNull() { // Given var fixture = new CMakeRunnerFixture { Settings = { SourcePath = null, OutputPath = null } }; // When var result = Record.Exception(() => fixture.Run()); // Then Assert.NotNull(result); Assert.IsType <ArgumentException>(result); Assert.Equal("The settings properties OutputPath or SourcePath should not be null.", ((ArgumentException)result).Message); }
public void ShouldAppendOptionsToArguments() { // Given const string Expected = "-S \"/Working/source\" \"-DCMAKE_IS_COOL\" \"-DCAKE_IS_COOL\""; var fixture = new CMakeRunnerFixture { Settings = { Options = new List <string> { "-DCMAKE_IS_COOL", "-DCAKE_IS_COOL" } } }; // When var result = fixture.Run(); // Then Assert.Equal(Expected, result.Args); }