예제 #1
0
        public void Test_CadastrarUmaVersaoComSucesso()
        {
            #region Parameters
            string statusEsperado = "NoContent";

            int    idProject       = 2;
            string versionName     = "v1.0.1";
            bool   versionReleased = true;
            bool   versionObsolete = true;
            #endregion

            #region Acoes
            AddVersionRequest addVersionRequest = new AddVersionRequest(idProject);

            //montando body
            version.name     = versionName;
            version.released = versionReleased;
            version.obsolete = versionObsolete;

            addVersionRequest.SetJsonBody(version);
            IRestResponse <dynamic> response = addVersionRequest.ExecuteRequest();
            #endregion

            #region Asserts

            Assert.AreEqual(statusEsperado, response.StatusCode.ToString());

            #endregion
        }
예제 #2
0
        public void Test_TentarCadastrarUmaVersaoQueJaExiste()
        {
            #region Parameters
            string statusEsperado = "BadRequest";

            int    idProject       = 1;
            string versionName     = "v1.0.0";
            bool   versionReleased = true;
            bool   versionObsolete = true;

            string mensagemEsperada    = "Version 'v1.0.0' already exists";
            string codigoEsperado      = "1600";
            string localizadorEsperado = "A version with that name already exists.";

            #endregion

            #region Acoes
            AddVersionRequest addVersionRequest = new AddVersionRequest(idProject);

            //montando body
            version.name     = versionName;
            version.released = versionReleased;
            version.obsolete = versionObsolete;

            addVersionRequest.SetJsonBody(version);
            IRestResponse <dynamic> response = addVersionRequest.ExecuteRequest();
            #endregion

            #region Asserts
            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusEsperado, response.StatusCode.ToString());
                Assert.AreEqual(mensagemEsperada, response.Data.message.ToString());
                Assert.AreEqual(codigoEsperado, response.Data.code.ToString());
                Assert.AreEqual(localizadorEsperado, response.Data.localized.ToString());
                //Etc
            });
            #endregion
        }
예제 #3
0
        public void Test_TentarCadastrarUmaVersaoSemNome()
        {
            #region Parameters
            string statusEsperado = "BadRequest";

            int  idProject       = 1;
            bool versionReleased = true;
            bool versionObsolete = true;

            string mensagemEsperada    = "Invalid version name";
            string codigoEsperado      = "11";
            string localizadorEsperado = "A necessary field \"name\" was empty. Please recheck your inputs.";

            #endregion

            #region Acoes
            AddVersionRequest addVersionRequest = new AddVersionRequest(idProject);

            //montando body
            version.name     = null;
            version.released = versionReleased;
            version.obsolete = versionObsolete;

            addVersionRequest.SetJsonBody(version);
            IRestResponse <dynamic> response = addVersionRequest.ExecuteRequest();
            #endregion

            #region Asserts
            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusEsperado, response.StatusCode.ToString());
                Assert.AreEqual(mensagemEsperada, response.Data.message.ToString());
                Assert.AreEqual(codigoEsperado, response.Data.code.ToString());
                Assert.AreEqual(localizadorEsperado, response.Data.localized.ToString());
            });
            #endregion
        }