public void Should_Internalize_If_Enabled_In_Settings() { // Given var fixture = new ILMergeRunnerFixture(); fixture.Settings.Internalize = true; // When var result = fixture.Run(); // Then Assert.Equal("/out:\"/Working/output.exe\" " + "/internalize \"/Working/input.exe\"", result.Args); }
public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code() { // Given var fixture = new ILMergeRunnerFixture(); fixture.GivenProcessExitsWithCode(1); // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsType <CakeException>(result); Assert.Equal("ILMerge: Process returned an error (exit code 1).", result?.Message); }
public void Should_Throw_If_Process_Was_Not_Started() { // Given var fixture = new ILMergeRunnerFixture(); fixture.GivenProcessCannotStart(); // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsType <CakeException>(result); Assert.Equal("ILMerge: Process was not started.", result?.Message); }
public void Should_Use_ILMerge_Executable_From_Tool_Path_If_Provided_On_Windows(string toolPath, string expected) { // Given var fixture = new ILMergeRunnerFixture(); fixture.Settings.ToolPath = toolPath; fixture.GivenSettingsToolPathExist(); // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Path.FullPath); }
public void Should_Throw_If_ILMerge_Executable_Was_Not_Found() { // Given var fixture = new ILMergeRunnerFixture(); fixture.GivenDefaultToolDoNotExist(); // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsType <CakeException>(result); Assert.Equal("ILMerge: Could not locate executable.", result.Message); }
public void Should_Set_Target_Platform_Without_NETFramework_Path_If_Enabled_In_Settings() { // Given var fixture = new ILMergeRunnerFixture(); fixture.Settings.TargetPlatform = new TargetPlatform(TargetPlatformVersion.v4); // When var result = fixture.Run(); // Then Assert.Equal("/out:\"/Working/output.exe\" " + "/targetPlatform:v4 \"/Working/input.exe\"", result.Args); }
public void Should_Add_Provided_Assemblies_To_Process_Arguments() { // Given var fixture = new ILMergeRunnerFixture(); fixture.AssemblyPaths.Add("C.dll"); fixture.AssemblyPaths.Add("D.dll"); // When fixture.Run(); // Then fixture.ProcessRunner.Received(1).Start(Arg.Is <ProcessStartInfo>( p => p.Arguments == "/out:\"/Working/output.exe\" \"/Working/input.exe\" \"/Working/C.dll\" \"/Working/D.dll\"")); }
public void Should_Use_ILMerge_Executable_From_Tool_Path_If_Provided(string toolPath, string expected) { // Given var fixture = new ILMergeRunnerFixture(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_Add_Provided_Assemblies_To_Process_Arguments() { // Given var fixture = new ILMergeRunnerFixture(); fixture.AssemblyPaths.Add("C.dll"); fixture.AssemblyPaths.Add("D.dll"); // When var result = fixture.Run(); // Then Assert.Equal("/out:\"/Working/output.exe\" " + "\"/Working/input.exe\" \"/Working/C.dll\" " + "\"/Working/D.dll\"", result.Args); }
public void Should_Set_Target_Kind_If_Enabled_In_Settings(TargetKind kind, string expected) { // Given var fixture = new ILMergeRunnerFixture(); fixture.Settings.TargetKind = kind; // When fixture.Run(); // Then fixture.ProcessRunner.Received(1).Start( Arg.Any <FilePath>(), Arg.Is <ProcessSettings>(p => p.Arguments.Render() == expected)); }
public void Should_Internalize_If_Enabled_In_Settings() { // Given var fixture = new ILMergeRunnerFixture(); fixture.Settings.Internalize = true; // When fixture.Run(); // Then fixture.ProcessRunner.Received(1).Start( Arg.Any <FilePath>(), Arg.Is <ProcessSettings>(p => p.Arguments.Render() == "/out:\"/Working/output.exe\" /internalize \"/Working/input.exe\"")); }
public void Should_Set_Target_Platform_If_Enabled_In_Settings() { // Given const string path = @"/NetFramework"; var directoryPath = new DirectoryPath(path); var fixture = new ILMergeRunnerFixture(); fixture.Settings.TargetPlatform = new TargetPlatform(TargetPlatformVersion.v4, directoryPath); // When var result = fixture.Run(); // Then Assert.Equal("/out:\"/Working/output.exe\" " + "/targetPlatform:v4,\"/NetFramework\" " + "\"/Working/input.exe\"", result.Args); }
public void Should_Set_Target_Platform_Without_NETFramework_Path_If_Enabled_In_Settings() { // Given var fixture = new ILMergeRunnerFixture(); fixture.Settings.TargetPlatform = new TargetPlatform(TargetPlatformVersion.v4); // When fixture.Run(); // Then fixture.ProcessRunner.Received(1).Start( Arg.Any <FilePath>(), Arg.Is <ProcessSettings>(p => p.Arguments.Render() == "/out:\"/Working/output.exe\" /targetPlatform:v4 \"/Working/input.exe\"")); }
public void Should_Set_Target_Platform_If_Enabled_In_Settings() { // Given const string path = @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1"; var directoryPath = new DirectoryPath(path); var fixture = new ILMergeRunnerFixture(); fixture.Settings.TargetPlatform = new TargetPlatform(TargetPlatformVersion.v4, directoryPath); // When fixture.Run(); // Then fixture.ProcessRunner.Received(1).Start( Arg.Any <FilePath>(), Arg.Is <ProcessSettings>(p => p.Arguments.Render() == "/out:\"/Working/output.exe\" /targetPlatform:v4,\"" + directoryPath.FullPath + "\" \"/Working/input.exe\"")); }