public async Task GetByTitle_WithInvalidInput_ShouldReturnInvalidResult(string title) { var dbContext = ApplicationDbContextCreatorInMemory.InitializeContext(); await this.SeedData(dbContext); var moviesRepository = new EfDeletableEntityRepository <Movie>(dbContext); var genresRepository = new EfDeletableEntityRepository <Genre>(dbContext); var service = new MoviesService(moviesRepository, genresRepository); Assert.Null(service.GetByTitle <MovieViewModel>(title)); }
public async Task Create_WithValidInput_ShouldReturnValidResult() { var dbContext = ApplicationDbContextCreatorInMemory.InitializeContext(); await this.SeedData(dbContext); var moviesRepository = new EfDeletableEntityRepository <Movie>(dbContext); var genresRepository = new EfDeletableEntityRepository <Genre>(dbContext); var service = new MoviesService(moviesRepository, genresRepository); var input = new MovieCreateModel() { Title = "Titanic", Country = "USA", GenreId = 1, }; var movie = service.Create(input); var result = service.GetByTitle <MovieViewModel>("Titanic"); Assert.Equal("USA", result.Country); }