Exemple #1
0
        // no project specified and there's no project in the store


        private System.Collections.Generic.List <TestPlan> getTestPlansByProjectName(
            TestProject currentTestProject,
            string[] testProjectNames,
            System.Collections.Generic.List <TestPlan> testPlans,
            bool makeFail,
            bool projectNamesNotSpecified)
        {
            TLGetTestPlanCmdletBase cmdlet = new TLGetTestPlanCmdletBase();

            if (projectNamesNotSpecified)
            {
                cmdlet.TestProjectName = null;
            }
            else
            {
                cmdlet.TestProjectName = testProjectNames;
            }
//cmdlet.WriteTrace(cmdlet, "getTestPlansByProjectName: 0001");
            System.Collections.Generic.List <TestProject> testProjects =
                new System.Collections.Generic.List <TestProject>();
            testProjects.Add(TLAddinData.CurrentTestProject);
//cmdlet.WriteTrace(cmdlet, "getTestPlansByProjectName: 0002");

            TLAddinData.CurrentTestLinkConnection =
                FakeTestLinkFactory.GetTestLinkWithTestPlans(testProjects, testPlans, null, null);
//cmdlet.WriteTrace(cmdlet, "getTestPlansByProjectName: 0003");
            if (projectNamesNotSpecified)
            {
//cmdlet.WriteTrace(cmdlet, "getTestPlansByProjectName: 0004_1");
                TLAddinData.CurrentTestProject = currentTestProject;
//cmdlet.WriteTrace(cmdlet, "getTestPlansByProjectName: 0004_2");
            }

            if (makeFail)
            {
//cmdlet.WriteTrace(cmdlet, "getTestPlansByProjectName: 0005_1");
                TLAddinData.CurrentTestLinkConnection = null;
//cmdlet.WriteTrace(cmdlet, "getTestPlansByProjectName: 0005_2");
            }

            TLSrvGetTestPlanCommand command =
                new TLSrvGetTestPlanCommand(cmdlet);

            command.Execute();
//cmdlet.WriteTrace(cmdlet, "getTestPlansByProjectName: 0006");
            System.Collections.Generic.List <TestPlan> resultList =
                new System.Collections.Generic.List <TestPlan>();
//cmdlet.WriteTrace(cmdlet, "getTestPlansByProjectName: 0007");
            foreach (object tpl in PSTestLib.UnitTestOutput.LastOutput)
            {
//cmdlet.WriteTrace(cmdlet, "getTestPlansByProjectName: 0008_1");
                resultList.Add((TestPlan)tpl);
//cmdlet.WriteTrace(cmdlet, "getTestPlansByProjectName: 0008_2");
            }
//cmdlet.WriteTrace(cmdlet, "getTestPlansByProjectName: 0009");
            return(resultList);
        }
        private System.Collections.Generic.List <TestPlan> getTestPlansFromProjectsInPipelineByName(
            System.Collections.Generic.List <TestProject> testProjects,
            System.Collections.Generic.List <TestPlan> testPlans,
            string[] testPlanNames,
            bool makeFail,
            bool inputNotSpecified)
        {
            GetTLTestPlanCommand cmdlet = new GetTLTestPlanCommand();

            if (inputNotSpecified)
            {
                cmdlet.InputObject = null;
            }
            else
            {
                TestProject[] projectsArray =
                    testProjects.ToArray();
                cmdlet.InputObject = projectsArray;
            }
            cmdlet.TestPlanName = testPlanNames;

            TLAddinData.CurrentTestLinkConnection =
                FakeTestLinkFactory.GetTestLinkWithTestPlans(testProjects, testPlans, null, null);

            if (inputNotSpecified)
            {
                TLAddinData.CurrentTestProject = testProjects[0];
            }

            if (makeFail)
            {
                TLAddinData.CurrentTestLinkConnection = null;
            }

            TLSrvGetTestPlanCommand command =
                new TLSrvGetTestPlanCommand(cmdlet);

            command.Execute();

            System.Collections.Generic.List <TestPlan> resultList =
                new System.Collections.Generic.List <TestPlan>();

            foreach (object tpl in PSTestLib.UnitTestOutput.LastOutput)
            {
                resultList.Add((TestPlan)tpl);
            }

            return(resultList);
        }