コード例 #1
0
        public void Filter_Based_On_AllSongSpecification()
        {
            var specification = new AllSongSpecification();

            var songs = new SongRepository().Read(specification);

            Assert.Equal(10, songs.Count);
        }
コード例 #2
0
        public void Filter_Based_On_AlbumSongSpecification()
        {
            var specification = new AlbumSongSpecification(2);

            var songs = new SongRepository().Read(specification);

            Assert.Equal(2, songs.Count);
            Assert.Equal("Thriller", songs.First().Title);
            Assert.Equal("Billie Jean", songs.ElementAt(1).Title);
        }
コード例 #3
0
        public void Filter_Based_On_AlbumSongSpecification_And_FilterSongSpecification()
        {
            var specification = new AndSpecification <Song>(new AlbumSongSpecification(2), new FilterSongSpecification
            {
                GenreIdsToInclude = new List <int> {
                    1, 2, 3
                },
                AlbumIdsToinclude = new List <int> {
                    1, 2, 3, 5
                },
                ArtistsToInclude = new List <string> {
                    "Eagles", "Michael Jackson", "Pink Floyd"
                },
                TitleFilter = "Th",
                MinRating   = 4
            });

            var songs = new SongRepository().Read(specification);

            Assert.Single(songs);
            Assert.Equal("Thriller", songs.First().Title);
        }
コード例 #4
0
        public void Filter_Based_On_FilterSongSpecification()
        {
            var specification = new FilterSongSpecification
            {
                GenreIdsToInclude = new List <int> {
                    1, 2, 3
                },
                AlbumIdsToinclude = new List <int> {
                    1, 2, 3, 5
                },
                ArtistsToInclude = new List <string> {
                    "Eagles", "Michael Jackson", "Pink Floyd"
                },
                TitleFilter = "Th",
                MinRating   = 4
            };

            var songs = new SongRepository().Read(specification);

            Assert.Equal(2, songs.Count);
            Assert.Equal("Life In The Fast Lane", songs.First().Title);
            Assert.Equal("Thriller", songs.ElementAt(1).Title);
        }