Exemplo n.º 1
0
        public void StarringRepoWhichIsNotPresent()
        {
            //Arrange
            string repoToBeStarredButNotInRepo = "Dummy10";
            string userName          = GitConfigurations.Default.username;
            var    repositoryOptions = new RepositoryOperations();

            //Act
            var responseFromServer = repositoryOptions.StarringRepository(userName, GitConfigurations.Default.password, repoToBeStarredButNotInRepo);

            //Assert
            Assert.AreEqual(HttpStatusCode.NotFound, responseFromServer.StatusCode);

            //Getting all the starred repos
            var allStarredRepos = repositoryOptions.GetStarredRepository(userName, GitConfigurations.Default.password);

            //Asserting the repo which is not starred is not in the list of all starred repos
            Assert.IsFalse(allStarredRepos.Result.Exists(e => e.name == repoToBeStarredButNotInRepo));
        }
Exemplo n.º 2
0
        public void StarringAndVerifyingRepository()
        {
            //Arrange
            string repoToBeStarred   = "Dummy1";
            string userName          = GitConfigurations.Default.username;
            var    repositoryOptions = new RepositoryOperations();

            //Act
            var responseFromServer = repositoryOptions.StarringRepository(userName, GitConfigurations.Default.password, repoToBeStarred);

            //Assert
            Assert.AreEqual(HttpStatusCode.NoContent, responseFromServer.StatusCode);
            //Getting all the starred repos
            var allStarredRepos = repositoryOptions.GetStarredRepository(userName, GitConfigurations.Default.password);

            //Verify the starred repos is in the list of all starred repos

            Assert.IsTrue(allStarredRepos.Result.Exists(e => e.name == repoToBeStarred));

            //Asserting the repo which is not starred is not in the list of all starred repos
            Assert.IsFalse(allStarredRepos.Result.Exists(e => e.name == "Hello1"));
        }