public void Can_generate_an_uninstallsolution_for_a_local_machine()
        {
            // Arrange

            // Act
            var actual = SharePointDeployment.GeneratePowerShellScript(string.Empty, SharePointAction.UninstallSolution, "2010", "OldVersion", "sharepoint.wsp", "http://sp2010", string.Empty, string.Empty, false, false, string.Empty);

            // Assert
            Assert.AreEqual(@"Add-PsSnapin Microsoft.SharePoint.PowerShell; Uninstall-SPSolution –Identity sharepoint.wsp -Confirm:$false –WebApplication http://sp2010", actual);
        }
        public void Can_generate_an_upgradesolution_for_a_local_machine_with_Gacdeploy()
        {
            // Arrange

            // Act
            var actual = SharePointDeployment.GeneratePowerShellScript(string.Empty, SharePointAction.UpdateSolution, "2010", "OldVersion", "sharepoint.wsp", string.Empty, @"c:\my files\sharepoint.wsp", string.Empty, true, false, string.Empty);

            // Assert
            Assert.AreEqual(@"Add-PsSnapin Microsoft.SharePoint.PowerShell; Update-SPSolution –Identity sharepoint.wsp –LiteralPath 'c:\my files\sharepoint.wsp' -GACDeployment", actual);
        }
Пример #3
0
        public void Can_generate_a_command_for_a_remote_machine()
        {
            // Arrange

            // Act
            var actual = SharePointDeployment.GeneratePowerShellScript("serverName", SharePointAction.AddSolution, "sharepoint.wsp", string.Empty, @"c:\my files\sharepoint.wsp", string.Empty, false, false, string.Empty);

            // Assert
            Assert.AreEqual(@"invoke-command -computername serverName {Add-PsSnapin Microsoft.SharePoint.PowerShell; Add-SPSolution -LiteralPath 'c:\my files\sharepoint.wsp'}", actual);
        }
Пример #4
0
        public void Can_generate_an_uninstallsolution_for_a_local_machine_with_no_webapp()
        {
            // Arrange

            // Act
            var actual = SharePointDeployment.GeneratePowerShellScript(string.Empty, SharePointAction.UninstallSolution, "sharepoint.wsp", string.Empty, string.Empty, string.Empty, false, false, string.Empty);

            // Assert
            Assert.AreEqual(@"Add-PsSnapin Microsoft.SharePoint.PowerShell; Uninstall-SPSolution –Identity sharepoint.wsp -Confirm:$false", actual);
        }
Пример #5
0
        public void Cannot_process_a_line_with_no_values_from_getfeature()
        {
            // Arrange

            // Act
            var actual = SharePointDeployment.ProcessPowerShellOutput(SharePointAction.GetFeature, "  ,  ,          ");

            // Assert
            Assert.AreEqual(0, actual.Length);
        }
        public void Can_generate_a_removesolution_for_a_local_machine()
        {
            // Arrange

            // Act
            var actual = SharePointDeployment.GeneratePowerShellScript(string.Empty, SharePointAction.RemoveSolution, "2010", "OldVersion", "sharepoint.wsp", string.Empty, string.Empty, string.Empty, false, false, string.Empty);

            // Assert
            Assert.AreEqual(@"Add-PsSnapin Microsoft.SharePoint.PowerShell; Remove-SPSolution –Identity sharepoint.wsp -Confirm:$false", actual);
        }
Пример #7
0
        public void Cannot_process_an_empty_line_from_getsolution()
        {
            // Arrange

            // Act
            var actual = SharePointDeployment.ProcessPowerShellOutput(SharePointAction.GetSolution, string.Empty);

            // Assert
            Assert.AreEqual(0, actual.Length);
        }
        public void Can_generate_an_addsolution_for_a_local_machine()
        {
            // Arrange

            // Act
            var actual = SharePointDeployment.GeneratePowerShellScript(string.Empty, SharePointAction.AddSolution, "2010", "OldVersion", "sharepoint.wsp", string.Empty, @"c:\my files\sharepoint.wsp", string.Empty, false, false, string.Empty);

            // Assert
            Assert.AreEqual(@"Add-PsSnapin Microsoft.SharePoint.PowerShell; Add-SPSolution -LiteralPath 'c:\my files\sharepoint.wsp'", actual);
        }
        public void Can_generate_an_installsolution_for_a_local_machine_without_Gacdeploy_or_webApp_but_with_force()
        {
            // Arrange

            // Act
            var actual = SharePointDeployment.GeneratePowerShellScript(string.Empty, SharePointAction.InstallSolution, "2010", "OldVersion", "sharepoint.wsp", string.Empty, string.Empty, string.Empty, false, true, string.Empty);

            // Assert
            Assert.AreEqual(@"Add-PsSnapin Microsoft.SharePoint.PowerShell; Install-SPSolution –Identity sharepoint.wsp -Force", actual);
        }
        public void Can_generate_a_enable_for_a_local_machine_with_url()
        {
            // Arrange

            // Act
            var actual = SharePointDeployment.GeneratePowerShellScript(string.Empty, SharePointAction.EnableFeature, "2010", "OldVersion", string.Empty, "http://sp2010", string.Empty, "featurename", false, false, string.Empty);

            // Assert
            Assert.AreEqual(@"Add-PsSnapin Microsoft.SharePoint.PowerShell; enable-spfeature –Identity featurename -Url http://sp2010", actual);
        }
        public void Can_generate_a_command_for_a_remote_machine_with_extra_parameters()
        {
            // Arrange

            // Act
            var actual = SharePointDeployment.GeneratePowerShellScript("serverName", SharePointAction.AddSolution, "2010", "OldVersion", "sharepoint.wsp", string.Empty, @"c:\my files\sharepoint.wsp", string.Empty, false, false, "-madeup1 parma -madeup2 'abc xyz'");

            // Assert
            Assert.AreEqual(@"invoke-command -computername serverName {Add-PsSnapin Microsoft.SharePoint.PowerShell; Add-SPSolution -LiteralPath 'c:\my files\sharepoint.wsp' -madeup1 parma -madeup2 'abc xyz'}", actual);
        }
        public void Can_generate_a_disable_for_a_local_machine_without_url_with_force()
        {
            // Arrange

            // Act
            var actual = SharePointDeployment.GeneratePowerShellScript(string.Empty, SharePointAction.DisableFeature, "2010", "OldVersion", string.Empty, string.Empty, string.Empty, "featurename", false, true, string.Empty);

            // Assert
            Assert.AreEqual(@"Add-PsSnapin Microsoft.SharePoint.PowerShell; disable-spfeature –Identity featurename -Confirm:$false -Force", actual);
        }
Пример #13
0
        public void Can_generate_an_installsolution_for_a_local_machine_with_Gacdeploy_with_webApp()
        {
            // Arrange

            // Act
            var actual = SharePointDeployment.GeneratePowerShellScript(string.Empty, SharePointAction.InstallSolution, "sharepoint.wsp", "http://spsite", string.Empty, string.Empty, true, false, string.Empty);

            // Assert
            Assert.AreEqual(@"Add-PsSnapin Microsoft.SharePoint.PowerShell; Install-SPSolution –Identity sharepoint.wsp –WebApplication http://spsite -GACDeployment", actual);
        }
Пример #14
0
        public void Can_process_single_line_from_getsolution()
        {
            // Arrange
            var data = "DisplayName : visualwebpartproject1.wsp" + Environment.NewLine +
                       "Deployed    : True" + Environment.NewLine +
                       "Id          : 4804dbf0-8a04-4ee9-92f9-d671f2cfd069";

            // Act
            var actual = SharePointDeployment.ProcessPowerShellOutput(SharePointAction.GetSolution, data);

            // Assert
            Assert.AreEqual(@"Name: [visualwebpartproject1.wsp], ID [4804dbf0-8a04-4ee9-92f9-d671f2cfd069], Deployed [True]", actual[0].ToString());
        }
Пример #15
0
        public void Can_process_multi_line_from_getfeature()
        {
            // Arrange
            var data =
                "DisplayName : PublishingStapling" + Environment.NewLine +
                "Id          : 001f4bd7-746d-403b-aa09-a6cc43de7942" + Environment.NewLine +
                "" + Environment.NewLine +
                "DisplayName : BasicWebParts" + Environment.NewLine +
                "Id          : 00bfea71-1c5e-4a24-b310-ba51c3eb7a57";

            // Act
            var actual = SharePointDeployment.ProcessPowerShellOutput(SharePointAction.GetFeature, data);

            // Assert
            Assert.AreEqual(2, actual.Length);
            Assert.AreEqual(@"Name: [PublishingStapling], ID [001f4bd7-746d-403b-aa09-a6cc43de7942], Deployed [True]", actual[0].ToString());
            Assert.AreEqual(@"Name: [BasicWebParts], ID [00bfea71-1c5e-4a24-b310-ba51c3eb7a57], Deployed [True]", actual[1].ToString());
        }
Пример #16
0
        public void Can_process_multi_line_from_getsolution()
        {
            // Arrange
            var data = "DisplayName : visualwebpartproject1.wsp" + Environment.NewLine +
                       "Deployed    : True" + Environment.NewLine +
                       "Id          : 4804dbf0-8a04-4ee9-92f9-d671f2cfd069" + Environment.NewLine +
                       Environment.NewLine +
                       "DisplayName : visualwebpartproject2.wsp" + Environment.NewLine +
                       "Deployed    : True" + Environment.NewLine +
                       "Id          : ffc41f41-f86d-490a-84d7-a1eb4f1fa1e6";

            // Act
            var actual = SharePointDeployment.ProcessPowerShellOutput(SharePointAction.GetSolution, data);

            // Assert
            Assert.AreEqual(2, actual.Length);
            Assert.AreEqual(@"Name: [visualwebpartproject1.wsp], ID [4804dbf0-8a04-4ee9-92f9-d671f2cfd069], Deployed [True]", actual[0].ToString());
            Assert.AreEqual(@"Name: [visualwebpartproject2.wsp], ID [ffc41f41-f86d-490a-84d7-a1eb4f1fa1e6], Deployed [True]", actual[1].ToString());
        }
        public void Can_generate_a_get_solution_status_for_a_local_machine_by_name()
        {
            string str = SharePointDeployment.GeneratePowerShellScript(string.Empty, SharePointAction.GetSolution, "2010", "OldVersion", "wspname.wsp", string.Empty, string.Empty, string.Empty, false, false, string.Empty);

            Assert.AreEqual <string>("Add-PsSnapin Microsoft.SharePoint.PowerShell; get-spsolution | where {$_.name -eq 'wspname.wsp'} | fl -property Displayname, Deployed, Id ;", str);
        }
        public void Can_generate_a_get_solution_status_for_a_local_machine_by_id()
        {
            string str = SharePointDeployment.GeneratePowerShellScript(string.Empty, SharePointAction.GetSolution, "2010", "OldVersion", "CB08B62C-20DD-4C69-B100-D80770BEB88E", string.Empty, string.Empty, string.Empty, false, false, string.Empty);

            Assert.AreEqual <string>("Add-PsSnapin Microsoft.SharePoint.PowerShell; get-spsolution | where {$_.id -eq 'CB08B62C-20DD-4C69-B100-D80770BEB88E'} | fl -property Displayname, Deployed, Id ;", str);
        }
        public void Can_generate_a_get_feature_status_for_a_local_machine_for_all_features()
        {
            string str = SharePointDeployment.GeneratePowerShellScript(string.Empty, SharePointAction.GetFeature, "2010", "OldVersion", string.Empty, string.Empty, string.Empty, string.Empty, false, true, string.Empty);

            Assert.AreEqual <string>("Add-PsSnapin Microsoft.SharePoint.PowerShell; get-spfeature | fl -property Displayname, Id ;", str);
        }
Пример #20
0
        public void Can_generate_a_get_solution_status_for_a_local_machine__for_all_solutions()
        {
            string str = SharePointDeployment.GeneratePowerShellScript(string.Empty, SharePointAction.GetSolution, string.Empty, string.Empty, string.Empty, string.Empty, false, false, string.Empty);

            Assert.AreEqual <string>("Add-PsSnapin Microsoft.SharePoint.PowerShell; get-spsolution | fl -property Displayname, Deployed, Id ;", str);
        }
Пример #21
0
        public void Can_generate_a_get_feature_status_for_a_local_machine_by_name()
        {
            string str = SharePointDeployment.GeneratePowerShellScript(string.Empty, SharePointAction.GetFeature, string.Empty, string.Empty, string.Empty, "my feature", false, true, string.Empty);

            Assert.AreEqual <string>("Add-PsSnapin Microsoft.SharePoint.PowerShell; get-spfeature | where {$_.displayname -eq 'my_feature'} | fl -property Displayname, Id ;", str);
        }