Exemplo n.º 1
0
        public void CreateTeamProject_PassInTestProjectDetailsWithExistingProjectName_ArgumentExceptionThrown()
        {
            // arrange
            ITeamProjects teamProjects = TeamProjectFactory.CreateTeamProjectMananger(TestConstants.TfsCollectionUri);
            string        projectName  = TestConstants.TfsTeamProjectName;

            IProcessTemplates processTemplates    = ProcessTemplateFactory.CreateProcessTemplateMananger(TestConstants.TfsCollectionUri);
            string            processTemplateName = processTemplates.ListProcessTemplates()[0].Name;

            // act
            teamProjects.CreateTeamProject(projectName, projectName + " Description", processTemplateName, false, false);

            // assert
            bool actual = false;

            foreach (string project in teamProjects.ListTeamProjectNames())
            {
                if (string.Compare(project, projectName, true) == 0)
                {
                    actual = true;
                    break;
                }
            }

            Assert.IsTrue(actual);
        }
Exemplo n.º 2
0
        public void CreateTeamProject_PassInTestProjectDetailsWithNoProcessTemplate_ArgumentExceptionThrown()
        {
            // arrange
            ITeamProjects teamProjects = TeamProjectFactory.CreateTeamProjectMananger(TestConstants.TfsCollectionUri);

            // act
            teamProjects.CreateTeamProject(TestProjectNameBase, TestProjectNameBase + " Description", null, false, false);

            // assert
        }
Exemplo n.º 3
0
        public void ListTeamProjectNames_Defaults_ReturnAIEnumerableOfString()
        {
            // arrange
            ITeamProjects teamProjects = TeamProjectFactory.CreateTeamProjectMananger(TestConstants.TfsCollectionUri);

            // act
            object actual = teamProjects.ListTeamProjectNames();

            // assert
            Assert.IsInstanceOfType(actual, typeof(IEnumerable <string>));
        }
Exemplo n.º 4
0
        public void DeleteTeamProject_PassInTestProjectDetailsWithNonExistingProjectName_ArgumentExceptionThrown()
        {
            // arrange
            ITeamProjects teamProjects = TeamProjectFactory.CreateTeamProjectMananger(TestConstants.TfsCollectionUri);
            string        projectName  = TestConstants.TfsTeamProjectName + Guid.NewGuid().ToString("N");

            // act
            teamProjects.DeleteTeamProject(projectName);

            // assert
        }
Exemplo n.º 5
0
        public void ClassCleanup()
        {
            ITeamProjects teamProjects = TeamProjectFactory.CreateTeamProjectMananger(TestConstants.TfsCollectionUri);

            foreach (string projectName in teamProjects.ListTeamProjectNames())
            {
                if (projectName.StartsWith(TestProjectNameBase))
                {
                    teamProjects.DeleteTeamProject(projectName, true, false);
                }
            }
        }
Exemplo n.º 6
0
        public void ListTeamProjectNames_Defaults_ReturnAIEnumerableOfStringContainingMoreThan0ProjectNames()
        {
            // arrange
            ITeamProjects teamProjects = TeamProjectFactory.CreateTeamProjectMananger(TestConstants.TfsCollectionUri);

            // act
            IEnumerable <string> projects = teamProjects.ListTeamProjectNames();

            // assert
            bool actual = false;

            foreach (string project in projects)
            {
                actual = true;
                break;
            }

            Assert.IsTrue(actual);
        }
Exemplo n.º 7
0
        public void CreateAndDeleteTeamProject_PassInTestProjectDetails_ProjectListToReturnTheNewProjectInTheListAndThenTheProjectToBeRemovedAndVerifyTheWarnings()
        {
            // arrange
            ITeamProjects teamProjects = TeamProjectFactory.CreateTeamProjectMananger(TestConstants.TfsCollectionUri);
            string        projectName  = TestProjectNameBase + Guid.NewGuid().ToString("N");

            IProcessTemplates processTemplates    = ProcessTemplateFactory.CreateProcessTemplateMananger(TestConstants.TfsCollectionUri);
            string            processTemplateName = processTemplates.ListProcessTemplates()[0].Name;

            // act
            teamProjects.CreateTeamProject(projectName, projectName + " Description", processTemplateName, false, false);

            // assert
            bool actual = false;

            foreach (string project in teamProjects.ListTeamProjectNames())
            {
                if (string.Compare(project, projectName, true) == 0)
                {
                    actual = true;
                    break;
                }
            }

            Assert.IsTrue(actual, "Create Failed.");
            List <Exception> exceptions;

            teamProjects.DeleteTeamProject(projectName, out exceptions, true, false);

            bool actualAfter = false;

            foreach (string project in teamProjects.ListTeamProjectNames())
            {
                if (string.Compare(project, projectName, true) == 0)
                {
                    actualAfter = true;
                    break;
                }
            }

            Assert.IsFalse(actualAfter, "Delete Failed.");
        }
Exemplo n.º 8
0
        public static void AssemblyInit(TestContext context)
        {
            using (ITeamProjectCollections teamProjectCollections = TeamProjectCollectionFactory.CreateTeamProjectCollectionMananger(TestConstants.TfsUri, TestConstants.DefaultCredentials))
            {
                if (!teamProjectCollections.CollectionExists(TestConstants.TfsCollectionName))
                {
                    teamProjectCollections.CreateProjectCollection(TestConstants.TfsCollectionName, TestConstants.TfsCollectionDescription);
                }
            }

            using (ITeamProjects teamProjectCollections = TeamProjectFactory.CreateTeamProjectMananger(TestConstants.TfsCollectionUri, TestConstants.DefaultCredentials))
            {
                if (!teamProjectCollections.TeamProjectExists(TestConstants.TfsTeamProjectName))
                {
                    string            processName      = string.Empty;
                    IProcessTemplates processTemplates = ProcessTemplateFactory.CreateProcessTemplateMananger(TestConstants.TfsCollectionUri);
                    processName = processTemplates.ListProcessTemplates()[0].Name;
                    if (!teamProjectCollections.CreateTeamProject(TestConstants.TfsTeamProjectName, TestConstants.TfsTeamProjectDescription, processName, false, false))
                    {
                        throw new Exception("Failed to create the default project for TFS API Tests.");
                    }
                }
            }
        }
Exemplo n.º 9
0
        public static void Refresh()
        {
            //Administration
            AreaManagerFactory.Reset();
            GlobalListFactory.Reset();
            IterationManagerFactory.Reset();
            ProcessTemplateFactory.Reset();
            TeamManagerFactory.Reset();
            TeamProjectFactory.Reset();
            TfsTeamProjectCollectionFactory.Reset();
            TeamProjectCollectionFactory.Reset();

            //Queries
            QueryRunnerFactory.Reset();

            //TestManagement
            TestCaseFactory.Reset();
            TestCaseStepFactory.Reset();
            TestSuiteFactory.Reset();
            TestSuiteManagerFactory.Reset();

            //WorkItemTracking
            WorkItemStoreFactory.Reset();
        }
Exemplo n.º 10
0
        public void GetInstanceFromFactory()
        {
            object teamProjects = TeamProjectFactory.CreateTeamProjectMananger(TestConstants.TfsCollectionUri);

            Assert.IsInstanceOfType(teamProjects, typeof(ITeamProjects));
        }