Пример #1
0
        // ReSharper disable once InconsistentNaming
        public async Task GetGenresByNamesAsync_should_return_empty_array_if_the_genre_names_array_is_empty()
        {
            using (var context = CreateContext())
            {
                await SeedGenresAsync(context);

                var repo = new GenresRepository(context);

                var genres = await repo.GetGenresByNamesAsync(Array.Empty<string>());

                Assert.Equal(0, genres.Length);
            }
        }
Пример #2
0
        // ReSharper disable once InconsistentNaming
        public async Task GetGenresByNamesAsync_should_return_empty_array_if_no_matching_genres_are_found()
        {
            using (var context = CreateContext())
            {
                await SeedGenresAsync(context);

                var repo = new GenresRepository(context);

                var names = new[]
                {
                    "action1",
                    "crime1"
                };

                var genres = await repo.GetGenresByNamesAsync(names);

                Assert.Equal(0, genres.Length);
            }
        }
Пример #3
0
        // ReSharper disable once InconsistentNaming
        public async Task GetGenresByNamesAsync_should_return_genres_by_names()
        {
            using (var context = CreateContext())
            {
                await SeedGenresAsync(context);

                var repo = new GenresRepository(context);

                var names = new[]
                {
                    "action",
                    "crime"
                };

                var genres = await repo.GetGenresByNamesAsync(names);

                Assert.Equal(names.Length, genres.Length);

                for (int i = 0; i < names.Length; i++)
                {
                    Assert.Equal(names[i], genres[i].Name);
                }
            }
        }