public void Test_CadastrarUmProjetoComSucessoDDT(ArrayList testData)
        {
            #region Parameters
            string statusEsperado = "Created";

            int    projectId          = Convert.ToInt32(testData[0]);
            string projectName        = testData[1].ToString();
            string projectDescription = testData[2].ToString();
            bool   projectEnabled     = Convert.ToBoolean(testData[3]);
            string projectFilePath    = testData[4].ToString();

            int    statusId    = Convert.ToInt32(testData[5]);
            string statusName  = testData[6].ToString();
            string statusLabel = testData[7].ToString();;

            int    viewStateId    = Convert.ToInt32(testData[8]);
            string viewStateName  = testData[9].ToString();
            string viewStateLabel = testData[10].ToString();

            #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
        }
        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();
        }
示例#4
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
        }