Exemplo n.º 1
0
        public void TestAllTracks()
        {
            var options   = new DbContextOptionsBuilder <MusicSpotDbContext>().UseInMemoryDatabase("returnTrackNotNull").Options;
            var dbContext = new MusicSpotDbContext(options);
            var service   = new TrackService(dbContext);

            var track = new Track
            {
                Name     = "Joni",
                Duration = "4:44",
                AlbumId  = 4
            };

            dbContext.Tracks.Add(track);
            dbContext.SaveChanges();

            var result = service.AllTracks(4);

            Assert.That(result, Is.Not.Null);
            Assert.AreNotEqual("aaaaaa", result.Result.UserId);
        }