Exemplo n.º 1
0
        public void GetAllAlbumsByUser_ReturnsCorrectAlbums()
        {
            // Arrange
            var context = this.ServiceProvider.GetRequiredService <WmipDbContext>();
            var album1  = new Album {
                Id = 1, Name = "Abm1", ArtistId = "1", ApprovalStatus = ApprovalStatus.Approved, ReleaseStage = ReleaseStage.Announced
            };
            var album2 = new Album {
                Id = 2, Name = "Abm2", ArtistId = "2", ApprovalStatus = ApprovalStatus.Approved, ReleaseStage = ReleaseStage.Announced
            };
            var album3 = new Album {
                Id = 3, Name = "Abm3", ArtistId = "3", ApprovalStatus = ApprovalStatus.Approved, ReleaseStage = ReleaseStage.Announced
            };

            context.Albums.AddRange(album1, album2, album3);
            context.SaveChanges();
            var albumsService = new AlbumsService(context);

            // Act
            var results = albumsService.GetAllAlbumsByUser("1");

            //Assert
            Assert.Equal(1, results.First().Id);
        }