コード例 #1
0
        public void GetTagsTest()
        {
            MovieDTO      inputMovie = TestingHelper.GetRandomMovie(0, 0, 0, 0, 3);
            List <string> results;

            // Seed the test database
            using (var context = new Cinephiliacs_MovieContext(dbOptions))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                TestingHelper.AddMovieDTOToDatabase(context, inputMovie);
            }

            using (var context = new Cinephiliacs_MovieContext(dbOptions))
            {
                RepoLogic       repoLogic       = new RepoLogic(context);
                IMovieLogic     movieLogic      = new MovieLogic(repoLogic);
                MovieController movieController = new MovieController(movieLogic);

                // Test GetAllTags()
                results = movieController.GetAllTags().Value;
            }

            Assert.Contains(inputMovie.MovieTags[0], results);
            Assert.Contains(inputMovie.MovieTags[1], results);
            Assert.Contains(inputMovie.MovieTags[2], results);
        }