Exemple #1
0
            public void Should_Add_Multiple_Accounts_To_Arguments_If_Set()
            {
                // Given
                var fixture = new TfxExtensionInstallRunnerFixture();

                fixture.GivenMultipleAccounts();

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

                // Then
                Assert.Equal("extension install --vsix \"c:/temp/test.vsix\" --accounts \"account1\" \"account2\" --auth-type pat", result.Args);
            }
Exemple #2
0
            public void Should_Find_Tfx_Executable_If_Tool_Path_Not_Provided()
            {
                // Given
                var fixture = new TfxExtensionInstallRunnerFixture();

                fixture.GivenSingleAccount();

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

                // Then
                Assert.Equal("/Working/tools/tfx.cmd", result.Path.FullPath);
            }
Exemple #3
0
            public void Should_Add_OutputType_To_Arguments_If_Set(TfxOutputType outputType, string expected)
            {
                // Given
                var fixture = new TfxExtensionInstallRunnerFixture();

                fixture.Settings.Output = outputType;
                fixture.GivenSingleAccount();

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

                // Then
                Assert.Equal(expected, result.Args);
            }
Exemple #4
0
            public void Should_Add_NoPrompt_To_Arguments_If_Set()
            {
                // Given
                var fixture = new TfxExtensionInstallRunnerFixture();

                fixture.Settings.NoPrompt = true;
                fixture.GivenSingleAccount();

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

                // Then
                Assert.Equal("extension install --vsix \"c:/temp/test.vsix\" --accounts \"account1\" --auth-type pat --no-prompt", result.Args);
            }
Exemple #5
0
            public void Should_Add_ServiceUrl_To_Arguments_If_Set()
            {
                // Given
                var fixture = new TfxExtensionInstallRunnerFixture();

                fixture.Settings.ServiceUrl = "http://test.com";
                fixture.GivenSingleAccount();

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

                // Then
                Assert.Equal("extension install --vsix \"c:/temp/test.vsix\" --accounts \"account1\" --auth-type pat --service-url \"http://test.com\"", result.Args);
            }
Exemple #6
0
            public void Should_Add_Token_To_Arguments_If_Set()
            {
                // Given
                var fixture = new TfxExtensionInstallRunnerFixture();

                fixture.Settings.Token = "abcdef";
                fixture.GivenSingleAccount();

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

                // Then
                Assert.Equal("extension install --vsix \"c:/temp/test.vsix\" --accounts \"account1\" --auth-type pat --token \"abcdef\"", result.Args);
            }
Exemple #7
0
            public void Should_Add_UserName_To_Arguments_If_Set()
            {
                // Given
                var fixture = new TfxExtensionInstallRunnerFixture();

                fixture.Settings.UserName = "******";
                fixture.GivenSingleAccount();

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

                // Then
                Assert.Equal("extension install --vsix \"c:/temp/test.vsix\" --accounts \"account1\" --auth-type pat --username \"gep13\"", result.Args);
            }
Exemple #8
0
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new TfxExtensionInstallRunnerFixture();

                fixture.GivenProcessExitsWithCode(1);
                fixture.GivenSingleAccount();

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

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("Tfx: Process returned an error (exit code 1).", result.Message);
            }
Exemple #9
0
            public void Should_Throw_If_Process_Was_Not_Started()
            {
                // Given
                var fixture = new TfxExtensionInstallRunnerFixture();

                fixture.GivenProcessCannotStart();
                fixture.GivenSingleAccount();

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

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("Tfx: Process was not started.", result.Message);
            }
Exemple #10
0
            public void Should_Use_Tfx_Executable_From_Tool_Path_If_Provided(string toolPath, string expected)
            {
                // Given
                var fixture = new TfxExtensionInstallRunnerFixture();

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

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

                // Then
                Assert.Equal(expected, result.Path.FullPath);
            }
Exemple #11
0
            public void Should_Throw_If_Tfx_Executable_Was_Not_Found()
            {
                // Given
                var fixture = new TfxExtensionInstallRunnerFixture();

                fixture.GivenDefaultToolDoNotExist();
                fixture.GivenSingleAccount();

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

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("Tfx: Could not locate executable.", result.Message);
            }
Exemple #12
0
            public void Should_Throw_If_Settings_Are_Null()
            {
                // Given
                var fixture = new TfxExtensionInstallRunnerFixture();

                fixture.Settings = null;
                fixture.GivenSingleAccount();

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

                // Then
                Assert.IsType <ArgumentNullException>(result);
                Assert.Equal("settings", ((ArgumentNullException)result).ParamName);
            }