Esempio n. 1
0
        public void ConsultarMusica()
        {
            #region Parameters
            string nomeMusica         = "Please Mister Postman - Remastered 2009";
            string statusCodeEsperado = "OK";
            #endregion

            //IRestResponse<dynamic> responsePlayList = consultaPlayListRequests.ExecuteRequest();
            //string idPlayList = HelpersSpotify.RetornaIdPlayList(responsePlayList, nomePlayList);

            CadastrarMusicaRequests cadastrarMusicaRequests = new CadastrarMusicaRequests(idPlaylist);

            ConsultarMusicaRequests consultarMusicaRequests = new ConsultarMusicaRequests(idPlaylist);

            #region Parameters
            //  string nomeMusica = "Please Mister Postman - Remastered 2009";
            string idMusica = "spotify:track:6wfK1R6FoLpmUA9lk5ll4T";
            #endregion
            cadastrarMusicaRequests.SetJsonBody(idMusica);
            IRestResponse responseCadastro = cadastrarMusicaRequests.ExecuteRequest();

            IRestResponse response = consultarMusicaRequests.ExecuteRequest();
            //List<string> listaMusica = HelpersSpotify.ObterListaResponse(response, true);

            //Assert.Multiple(() =>
            //{
            //    Assert.AreEqual(statusCodeEsperado, response.StatusCode.ToString());
            //    Assert.IsTrue(GeneralHelpers.VerificaSeStringEstaContidaNaLista(listaMusica, nomeMusica));
            //});
        }
Esempio n. 2
0
        public void CadastrarMusica()
        {
            #region Parameters
            string nomeMusica         = "Please Mister Postman - Remastered 2009";
            string nomePlayList       = "Teste Postman";
            string idMusica           = "spotify:track:6wfK1R6FoLpmUA9lk5ll4T";
            string statusCodeEsperado = "Created";
            #endregion

            //IRestResponse<dynamic> responsePlayList = consultaPlayListRequests.ExecuteRequest();
            //string idPlayList = HelpersSpotify.RetornaIdPlayList(responsePlayList, nomePlayList);

            DeletarMusicaRequests deletarMusicaRequests = new DeletarMusicaRequests(idPlaylist);
            // DeletarMusicaRequests deletarMusicaRequests = new DeletarMusicaRequests(idPlayList);
            deletarMusicaRequests.SetJsonBody(idMusica);
            IRestResponse response = deletarMusicaRequests.ExecuteRequest();

            CadastrarMusicaRequests cadastrarMusicaRequests = new CadastrarMusicaRequests(idPlaylist);
            // CadastrarMusicaRequests cadastrarMusicaRequests = new CadastrarMusicaRequests(idPlayList);

            cadastrarMusicaRequests.SetJsonBody(idMusica);
            IRestResponse responseCadastrado = cadastrarMusicaRequests.ExecuteRequest();

            ConsultarMusicaRequests consultarMusicaRequests = new ConsultarMusicaRequests(idPlaylist);
            // ConsultarMusicaRequests consultarMusicaRequests = new ConsultarMusicaRequests(idPlayList);
            IRestResponse responseMusica = consultarMusicaRequests.ExecuteRequest();
            List <string> listaMusica    = GeneralHelpers.ObterListaResponse(responseMusica, nomeVetor, nomeVetorFilho, valorChave);

            Assert.Multiple(() =>
            {
                Assert.AreEqual(statusCodeEsperado, responseCadastrado.StatusCode.ToString());
                Assert.IsTrue(GeneralHelpers.VerificaSeStringEstaContidaNaLista(listaMusica, nomeMusica));
                Assert.AreEqual(1, listaMusica.Count);
            });
        }