Exemple #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);
        }
Exemple #2
0
        public void CreateTeamProject_PassInTestProjectDetailsWithNoProcessTemplate_ArgumentExceptionThrown()
        {
            // arrange
            ITeamProjects teamProjects = TeamProjectFactory.CreateTeamProjectMananger(TestConstants.TfsCollectionUri);

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

            // assert
        }
Exemple #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>));
        }
Exemple #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
        }
Exemple #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);
                }
            }
        }
Exemple #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);
        }
Exemple #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.");
        }
Exemple #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.");
                    }
                }
            }
        }
Exemple #9
0
        public void GetInstanceFromFactory()
        {
            object teamProjects = TeamProjectFactory.CreateTeamProjectMananger(TestConstants.TfsCollectionUri);

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