示例#1
0
        public void GetNotSecretById_ReturnsCorrectAlbums()
        {
            // Arrange
            var context = this.ServiceProvider.GetRequiredService <WmipDbContext>();
            var album1  = new Album {
                Id = 1, Name = "Abm"
            };
            var album2 = new Album {
                Id = 2, Name = "Abm", ApprovalStatus = ApprovalStatus.Approved, ReleaseStage = ReleaseStage.Announced
            };
            var album3 = new Album {
                Id = 3, Name = "Abm"
            };

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

            // Act
            var nonExisting = albumsService.GetNotSecretById(1);
            var exising     = albumsService.GetNotSecretById(2);

            //Assert
            Assert.Null(nonExisting);
            Assert.NotNull(exising);
        }