public void BanTagTest() { var inputMovie = TestingHelper.GetRandomMovie(); var inputTag = TestingHelper.GetRandomTaggingDTO(inputMovie.ImdbId); bool inputBanState = false; Tag tag; // Seed the test database using (var context = new Cinephiliacs_MovieContext(dbOptions)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); TestingHelper.AddMovieDTOToDatabase(context, inputMovie); TestingHelper.AddTagToDatabase(context, inputTag, inputBanState); RepoLogic repoLogic = new RepoLogic(context); IMovieLogic movieLogic = new MovieLogic(repoLogic); MovieController movieController = new MovieController(movieLogic); // Test BanTag() movieController.BanTag(inputTag.TagName); } using (var context = new Cinephiliacs_MovieContext(dbOptions)) { tag = context.Tags.FirstOrDefault(t => t.TagName == inputTag.TagName); } Assert.True(tag.IsBanned); }