Exemplo n.º 1
0
        public void VerifyStatusCodeForAlreadyCreatedRepos()
        {
            //Arrange
            string alreadyCreateRepoName = "Dummy1";
            string userName = GitConfigurations.Default.username;
            var    bodyForRepositoryCreation = DataHelper.PopulateJsonDataForNewPublicRepository(alreadyCreateRepoName, "This is for testing purpose");
            var    repositoryOptions         = new RepositoryOperations();

            //Act
            var responseFromServer = repositoryOptions.CreateNewRepository(userName, GitConfigurations.Default.password, bodyForRepositoryCreation);

            //Assert
            Assert.AreEqual(HttpStatusCode.UnprocessableEntity, responseFromServer.StatusCode);
        }
Exemplo n.º 2
0
        public void CreateAndVerifyRepository()
        {
            //Arrange
            string expectedRepoName           = "Dummy3";
            string userName                   = GitConfigurations.Default.username;
            var    bodyDataForCreatingNewRepo = DataHelper.PopulateJsonDataForNewPublicRepository(expectedRepoName, "This is for dummy operation");
            var    repositoryOperations       = new RepositoryOperations();

            //Act
            var responseFromServer = repositoryOperations.CreateNewRepository(userName, GitConfigurations.Default.password, bodyDataForCreatingNewRepo);

            //Assert
            int    idFromCreatedRemo   = responseFromServer.Result.id;
            string nameFromCreatedRepo = responseFromServer.Result.name;

            Assert.AreEqual(responseFromServer.StatusCode, HttpStatusCode.Created);
            Assert.AreEqual(nameFromCreatedRepo, expectedRepoName);

            //GetAllReposFromServer
            var allReposFromServer = repositoryOperations.GetRepositoryForUser(userName, GitConfigurations.Default.PersonalToken);

            //Verifing the id of the created repostiory in GetAllRepos Collection
            Assert.Equals(allReposFromServer.Result.Single(e => e.id == idFromCreatedRemo).id, idFromCreatedRemo);
        }