コード例 #1
0
        public void CollectionExists_CollectionThatExist_ReturnTrue()
        {
            // arrange
            ITeamProjectCollections teamProjectCollections = TeamProjectCollectionFactory.CreateTeamProjectCollectionMananger(TestConstants.TfsUri);
            string collectionName = TestConstants.TfsCollectionName;

            // act
            bool actual = teamProjectCollections.CollectionExists(collectionName);

            // assert
            Assert.IsTrue(actual);
        }
コード例 #2
0
        public void CollectionExists_CollectionThatDoesnotExist_ReturnFalse()
        {
            // arrange
            ITeamProjectCollections teamProjectCollections = TeamProjectCollectionFactory.CreateTeamProjectCollectionMananger(TestConstants.TfsUri);
            string collectionName = Guid.NewGuid().ToString("N");

            // act
            bool actual = teamProjectCollections.CollectionExists(collectionName);

            // assert
            Assert.IsFalse(actual);
        }
コード例 #3
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.");
                    }
                }
            }
        }