public void ListProjects_AfterHavingCreateOneProjectInTeam_ShouldReturnAtLestTheCreatedProject()
        {
            var projectKey = "Test_" + Guid.NewGuid().ToString("N"); // must start by a letter
            var project    = new Project
            {
                key         = projectKey,
                name        = "Name of " + projectKey,
                is_private  = true,
                description = "project created by the unit test ListProjects_AfterHavingAddAProject_ShouldReturnAtLestTheCreatedProject"
            };

            project = teamResource.PostProject(project);

            try
            {
                var projects = teamResource.ListProjects();
                projects.ShouldNotBeEmpty();
                projects.Any(r => r.name == project.name).ShouldBe(true);
                projects.Select(p => p.ShouldBeFilled())
                .Any(r => r.name == project.name).ShouldBe(true);
            }
            finally
            {
                teamResource.ProjectResource(project.key).DeleteProject();
            }
        }
示例#2
0
        public void PutGetDeleteProject_InTeam_AllOperationsWorks()
        {
            var projectKey      = "Test_" + Guid.NewGuid().ToString("N"); // must start by a letter
            var projectResource = teamResource.ProjectResource(projectKey);
            var newProject      = new Project
            {
                name        = "Name of " + projectKey,
                description = "project generated by test " + nameof(PutGetDeleteProject_InTeam_AllOperationsWorks),
                is_private  = true
            };

            try
            {
                // create with PUT
                var createdProject = projectResource.PutProject(newProject);
                createdProject.ShouldBeFilled();
                createdProject.key.ShouldBe(projectKey);
                createdProject.name.ShouldBe(newProject.name);
                createdProject.description.ShouldBe(newProject.description);
                createdProject.is_private.ShouldBe(newProject.is_private);
                createdProject.owner.username.ShouldBe(teamName);

                // get
                var getProject = projectResource.GetProject();
                getProject.ShouldBeEquivalentTo(createdProject);

                // update
                getProject.description += " -- altered description";
                var updatedProject = projectResource.PutProject(getProject);
                updatedProject.ShouldBeEquivalentExceptUpdateDateTo(getProject);
            }
            finally
            {
                // delete
                projectResource.DeleteProject();
            }
        }