public static void CadastrarUmProjeto(string nomeProjeto)
        {
            CreateAProjectRequest createAProjectRequest = new CreateAProjectRequest();

            status.id       = 10;
            status.name     = "development";
            status.label    = "development";
            viewState.id    = 10;
            viewState.name  = "public";
            viewState.label = "public";

            project.name        = nomeProjeto;
            project.description = nomeProjeto + " descrição";
            project.enabled     = true;
            project.file_path   = "/tmp/";
            project.status      = status;
            project.view_state  = viewState;
            createAProjectRequest.SetJsonBody(project);

            createAProjectRequest.ExecuteRequest();
        }
        public static void CadastrarUmProjetoPadrao()
        {
            CreateAProjectRequest createAProjectRequest = new CreateAProjectRequest();
            Project   project   = new Project();
            Status    status    = new Status();
            ViewState viewState = new ViewState();

            status.id       = 10;
            status.name     = "development";
            status.label    = "development";
            viewState.id    = 10;
            viewState.name  = "public";
            viewState.label = "public";

            project.name        = "Projeto padrao";
            project.description = "Projeto padrao descricao";
            project.enabled     = true;
            project.file_path   = "/tmp/";
            project.status      = status;
            project.view_state  = viewState;
            createAProjectRequest.SetJsonBody(project);

            createAProjectRequest.ExecuteRequest();
        }
예제 #3
0
        public void Test_TentarCadastrarUmProjetoSemNome()
        {
            #region Parameters
            CreateAProjectRequest createAProjectRequest = new CreateAProjectRequest();
            Project   project   = new Project();
            Status    status    = new Status();
            ViewState viewState = new ViewState();

            string statusEsperado = "Created";

            //int projectId = 1;
            string projectName        = "Projeto Post Create 01";
            string projectDescription = "Projeto Post Create 01 description";
            bool   projectEnabled     = true;
            string projectFilePath    = "/tmp/";

            int    statusId    = 10;
            string statusName  = "development";
            string statusLabel = "development";

            int    viewStateId    = 10;
            string viewStateName  = "public";
            string viewStateLabel = "public";

            #endregion

            #region Acoes

            status.id    = statusId;
            status.name  = statusName;
            status.label = statusLabel;

            viewState.id    = viewStateId;
            viewState.name  = viewStateName;
            viewState.label = viewStateLabel;

            //montando body
            // project.id = projectId;
            project.name        = projectName;
            project.description = projectDescription;
            project.enabled     = projectEnabled;
            project.file_path   = projectFilePath;
            project.status      = status;
            project.view_state  = viewState;

            createAProjectRequest.SetJsonBody(project);

            IRestResponse <dynamic> response = createAProjectRequest.ExecuteRequest();
            #endregion

            #region Asserts

            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusEsperado, response.StatusCode.ToString());
                Assert.AreEqual(projectName, response.Data.project.name.ToString());
                Assert.AreEqual(projectDescription, response.Data.project.description.ToString());
                //Etc
            });

            #endregion
        }