Ejemplo n.º 1
0
            public void Should_Set_Working_Directory()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("/Working", result.Process.WorkingDirectory.FullPath);
            }
Ejemplo n.º 2
0
            public void Should_Find_ILRepack_Executable_If_Tool_Path_Was_Not_Provided()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("/Working/tools/ILRepack.exe", result.Path.FullPath);
            }
Ejemplo n.º 3
0
            public void Should_Not_Set_Target_Platform_If_Not_Enabled_In_Settings()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("/out:\"/Working/output.exe\" " +
                             "\"/Working/input.exe\"", result.Args);
            }
Ejemplo n.º 4
0
            public void Should_Set_Target_Kind_If_Enabled_In_Settings(TargetKind kind, string expected)
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                fixture.Settings.TargetKind = kind;

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal(expected, result.Args);
            }
Ejemplo n.º 5
0
            public void Should_Throw_If_Primary_Assembly_Path_Was_Null()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                fixture.PrimaryAssemblyPath = null;

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                Assert.IsArgumentNullException(result, "primaryAssemblyPath");
            }
Ejemplo n.º 6
0
            public void Should_Throw_If_Assembly_Paths_Are_Null()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                fixture.AssemblyPaths = null;

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                Assert.IsArgumentNullException(result, "assemblyPaths");
            }
Ejemplo n.º 7
0
            public void Should_Use_ILRepack_Executable_From_Tool_Path_If_Provided_On_Windows(string toolPath, string expected)
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                fixture.Settings.ToolPath = toolPath;
                fixture.GivenSettingsToolPathExist();

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal(expected, result.Path.FullPath);
            }
Ejemplo n.º 8
0
            public void Should_Throw_If_ILRepack_Executable_Was_Not_Found()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                fixture.GivenDefaultToolDoNotExist();

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("ILRepack: Could not locate executable.", result.Message);
            }
Ejemplo n.º 9
0
            public void Should_Set_Verbose_If_Enabled_In_Settings()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                fixture.Settings.Verbose = true;

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("/verbose /out:\"/Working/output.exe\" " +
                             "\"/Working/input.exe\"", result.Args);
            }
Ejemplo n.º 10
0
            public void Should_Set_AllowDuplicateResources_If_Enabled_In_Settings()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                fixture.Settings.AllowDuplicateResources = true;

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("/allowduplicateresources /out:\"/Working/output.exe\" " +
                             "\"/Working/input.exe\"", result.Args);
            }
Ejemplo n.º 11
0
            public void Should_Throw_If_Process_Was_Not_Started()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                fixture.GivenProcessCannotStart();

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("ILRepack: Process was not started.", result.Message);
            }
Ejemplo n.º 12
0
            public void Should_Set_Target_Platform_If_Enabled_In_Settings()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                fixture.Settings.TargetPlatform = TargetPlatformVersion.v4;

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("/targetplatform:v4 /out:\"/Working/output.exe\" " +
                             "\"/Working/input.exe\"", result.Args);
            }
Ejemplo n.º 13
0
            public void Should_Set_Attr_If_Enabled_In_Settings()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                fixture.Settings.Attr = "/CommonAssemblyInfo.cs";

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("/attr:\"/CommonAssemblyInfo.cs\" /out:\"/Working/output.exe\" " +
                             "\"/Working/input.exe\"", result.Args);
            }
Ejemplo n.º 14
0
            public void Should_Set_Log_If_Enabled_In_Settings()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                fixture.Settings.Log = "/output.log";

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("/log:\"/output.log\" /out:\"/Working/output.exe\" " +
                             "\"/Working/input.exe\"", result.Args);
            }
Ejemplo n.º 15
0
            public void Should_Set_KeyFile_If_Enabled_In_Settings()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                fixture.Settings.Keyfile = "/key.pfx";

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("/keyfile:\"/key.pfx\" /out:\"/Working/output.exe\" " +
                             "\"/Working/input.exe\"", result.Args);
            }
Ejemplo n.º 16
0
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                fixture.GivenProcessExitsWithCode(1);

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("ILRepack: Process returned an error (exit code 1).", result.Message);
            }
Ejemplo n.º 17
0
            public void Should_Set_Libs_If_Enabled_In_Settings()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                fixture.Settings.Libs = new List <FilePath> {
                    "/lib1.dll", "/lib2.dll"
                };

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("/lib:\"/lib1.dll\" /lib:\"/lib2.dll\" /out:\"/Working/output.exe\" " +
                             "\"/Working/input.exe\"", result.Args);
            }
Ejemplo n.º 18
0
            public void Should_Add_Provided_Assemblies_To_Process_Arguments()
            {
                // Given
                var fixture = new ILRepackRunnerFixture();

                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);
            }