public void GetTop5OriginalsTest() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "InHarmonyTestControllerDB") .Options; using (var context = new ApplicationDbContext(options)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); Repository repository = new Repository(context, _repositoryLogger); BusinessLogicClass logic = new BusinessLogicClass(repository, _mapperClass, _repositoryLogger); SongController songController = new SongController(logic, _songControllerLogger); // create a few songs... for (int i = 0; i < 5; i++) { var song = new Song(); repository.songs.Add(song); } context.SaveChanges(); var s = songController.GetTop5Originals(); Assert.Equal(5, s.Result.Count); } }