public async void GetSingleSongTest() { DbContextOptions <MusicDbContext> options = new DbContextOptionsBuilder <MusicDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options; using (MusicDbContext context = new MusicDbContext(options)) { // Arrange Playlist playlist = new Playlist() { Name = "test" }; context.Playlists.Add(playlist); await context.SaveChangesAsync(); Song song = new Song() { Name = "Shake It Off", Artist = "Taylor Swift", Album = "1989", Genre = "Pop", ReleaseDate = DateTime.Today, PlaylistID = 1 }; SongController sc = new SongController(context); context.Songs.Add(song); context.SaveChanges(); var findSong = await context.Songs.FirstAsync(s => s.Name == song.Name); // Act var result = sc.GetSongByID(findSong.ID); var answer = (OkObjectResult)result; // Assert Assert.Equal((HttpStatusCode.OK), (HttpStatusCode)answer.StatusCode); } }