public void WhenTheUserSelectsAMovieWhichIsInHisWishlistAlready() { var moviesPage = new MoviesPage(driver); moviesPage.MovieInWishlist.Click(); Assert.That(moviesPage.AddToWishlistBtn.Displayed, Is.True); }
public App() { InitializeComponent(); DependencyService.Register <MockDataStore>(); MainPage = new MoviesPage(); }
public void GivenTheUserNavigatesToTheLatestMoviesPage() { var homePage = new HomePage(driver); var moviesPage = new MoviesPage(driver); homePage.LatestMoviesBtn.Click(); Assert.That(moviesPage.PageTitle.Text, Is.EqualTo("All Movies")); }
public void TestMockMovies() { MoviesPage moviesPage = new MoviesPage { Page = 1, Per_page = 10, Total = 9, Total_pages = 1 }; moviesPage.Data.Add(new MovieData { Title = "MovieTest", Year = 2019 }); moviesPage.Data.Add(new MovieData { Title = "MovieTest", Year = 2017 }); moviesPage.Data.Add(new MovieData { Title = "MovieTest", Year = 2012 }); moviesPage.Data.Add(new MovieData { Title = "MovieTest", Year = 2019 }); moviesPage.Data.Add(new MovieData { Title = "MovieTest", Year = 2017 }); moviesPage.Data.Add(new MovieData { Title = "MovieTest", Year = 2017 }); moviesPage.Data.Add(new MovieData { Title = "MovieTest", Year = 2012 }); moviesPage.Data.Add(new MovieData { Title = "MovieTest", Year = 2019 }); moviesPage.Data.Add(new MovieData { Title = "MovieTest", Year = 2017 }); var mockRepository = new Mock <IMoviesRepository>(); mockRepository.Setup(x => x.GetMoviesByTitle(string.Empty, 1)).Returns(Task.FromResult(moviesPage)); //mockRepository.Setup(x => x.GetMoviesByTitle(string.Empty, 2)).Returns(Task.FromResult(new MoviesPage())); var moviesService = new MoviesService(mockRepository.Object); var json = moviesService.GetMoviesSummarizedByYear(string.Empty); Movies resultMovies = JsonConvert.DeserializeObject <Movies>(json.Result.ToString()); Assert.Equal(9, resultMovies.Total); Assert.Equal(2012, resultMovies.MoviesByYear[0].Year); Assert.Equal(2, resultMovies.MoviesByYear[0].Movies); Assert.Equal(2017, resultMovies.MoviesByYear[1].Year); Assert.Equal(4, resultMovies.MoviesByYear[1].Movies); Assert.Equal(2019, resultMovies.MoviesByYear[2].Year); Assert.Equal(3, resultMovies.MoviesByYear[2].Movies); }
public App() { // Drop the DB tables DropAllTables(); // Create the DB tables CreateAllTables(); // The root page of your application MainPage = new MoviesPage(); }
public void ThenMoviesWithTheShouldBeDisplayed(string category, string categoryValue) { var moviesPage = new MoviesPage(driver); if (category == "genre") { moviesPage.SelectRandomMovie(); Assert.That(moviesPage.Genre.Text.Contains(categoryValue), Is.True); } else { moviesPage.MovieInWishlist.Click(); Assert.That(moviesPage.Actors.Text.Contains(categoryValue), Is.True); } }
public void ThenTheMovieCanBeSeenInHisWishlist() { var moviesPage = new MoviesPage(driver); string movieTitle = "Cam"; moviesPage.WishlistBtn.Click(); var movie = driver.FindElement(By.ClassName("row")) .FindElements(By.TagName("h2")) .FirstOrDefault(e => e.Text.Contains(movieTitle)); Assert.That(movie.Text.Contains(movieTitle), Is.True); //clean up - remove the movie from the wishlist movie.Click(); moviesPage.RemoveFromWishlistBtn.Click(); }
public override async Task <Movies> GetMovieByName(NameMovie request, Grpc.Core.ServerCallContext context) { try { var httpContext = context.GetHttpContext(); var clientCertificate = httpContext.Connection.ClientCertificate; string url = "https://jsonmock.hackerrank.com/api/movies/search/?Title=" + request.Name; var response = await client.GetStringAsync(url); MoviesPage moviesPage = JsonConvert.DeserializeObject <MoviesPage>(response); //Verificar de precisa inicializar. Movies movies = new Movies(); movies.Total = moviesPage.Total; //Run the next iteration, because the first was executed for (int i = 2; i <= moviesPage.Total_pages; i++) { List <MovieData> movieData = new List <MovieData>(); movieData = await GetMoviebyNameAndPage(request.Name, i.ToString()); moviesPage.Data.AddRange(movieData); } foreach (var line in moviesPage.Data.GroupBy(movie => movie.Year) .Select(group => new { Year = group.Key, Count = group.Count() }) .OrderBy(x => x.Year)) { MoviesByYear moviesByYear = new MoviesByYear(); moviesByYear.Year = line.Year; moviesByYear.Movies = line.Count; movies.MoviesByYear.Add(moviesByYear); } return(movies); } catch (Exception ex) { throw new Exception("Erro ao pesquisar o filme " + request.Name + "." + "Excessão: " + ex.Message); } }
public async Task <List <MovieData> > GetMoviebyNameAndPage(String name, String numberPage) { try { string url = "https://jsonmock.hackerrank.com/api/movies/search/?Title=" + name + "&page=" + numberPage; var response = await client.GetStringAsync(url); MoviesPage moviesPage = JsonConvert.DeserializeObject <MoviesPage>(response); return(moviesPage.Data); //return only name and years of movies } catch (Exception ex) { throw new Exception("Erro ao pesquisar o filme " + name + " na página " + numberPage.ToString() + "." + "Excessão: " + ex.Message); } }
private async void MainBtn_Clicked(object sender, EventArgs e) { try { if (_lockBtn.Wait(30)) { var moviesPageRes = await MoviesPage.CreatePage(); if (moviesPageRes.Succeeded) { await Navigation.PushAsync(moviesPageRes.Result); } else { await DisplayAlert("Error", moviesPageRes.Ex.Message, "Ok"); } } } finally { _lockBtn.Release(); } }
public void ThenAMovieShouldBeDisplayed(string movieTitle) { var moviesPage = new MoviesPage(driver); Assert.That(moviesPage.SearchMovie.Text.Contains(movieTitle), Is.True); }
public void WhenPressesTheSearchButton() { var moviesPage = new MoviesPage(driver); moviesPage.SearchBtn.Click(); }
public void WhenSelectsFromADropdownMenu(string searchCategory) { var moviesPage = new MoviesPage(driver); moviesPage.SearchCategory(searchCategory); }
public void WhenTheUserEntersInTheSearchField(string searchString) { var moviesPage = new MoviesPage(driver); moviesPage.SearchField.SendKeys(searchString); }
public App() { // The root page of your application MainPage = new MoviesPage(); }
public void WhenClicksTheAddToWishlistButton() { var moviesPage = new MoviesPage(driver); moviesPage.AddToWishlistBtn.Click(); }
public void Setup() { driver = new ChromeDriver(); driver.Manage().Window.Maximize(); movies = new MoviesPage(driver); }
public void ThenAnErrorMessageAppears(string message) { var moviesPage = new MoviesPage(driver); Assert.That(moviesPage.MsgAlert.Text, Is.EqualTo(message)); }
public App() { InitializeComponent(); MainPage = new MoviesPage(); }
public void ThenAConfirmationMessageShouldAppear(string message) { var moviesPage = new MoviesPage(driver); Assert.That(moviesPage.MsgAlert.Text, Is.EqualTo(message)); }