Ejemplo n.º 1
0
        public void CallsAllNotDeletedReturnsNotDeletedOnly()
        {
            //Arrange
            List <Genres> genres = new List <Genres>();
            var           genre  = new Genres
            {
                Name      = "name1",
                IsDeleted = true
            };
            var genre2 = new Genres
            {
                Name      = "name2",
                IsDeleted = false
            };

            genres.Add(genre);
            genres.Add(genre2);
            genresRepo.Setup(x => x.AllNotDeleted()).Returns(genres.AsQueryable());
            var sut = new GenreService(movies.Object, genresRepo.Object, commentsRepo.Object, userRepo.Object, likesRepo.Object, dislikesRepo.Object, saver.Object);

            //Act
            var result = sut.GetAllNotExpired();

            //Assert
            Assert.IsTrue(result.Select(x => x.Name).Contains("name2"));
            Assert.IsFalse(result.Select(x => x.Name).Contains("hey1"));
            genresRepo.Verify(x => x.AllNotDeleted(), Times.Once);
        }