Пример #1
0
        public void GetAllBandsLambdaTest()
        {
            List <MusicAlbum> albums = new List <MusicAlbum>
            {
                new MusicAlbum("TestName", 200, 2200, "Pink Floyd"),
                new MusicAlbum("TestName", 200, 2100, "Pink Floyd"),
                new MusicAlbum("TestName", 200, 2000, "Pink Floyd"),
                new MusicAlbum("TestName", 201, 2005, "Pink Floyd"),
                new MusicAlbum("TestName", 202, 2006, "Metallica"),
                new MusicAlbum("TestName", 203, 2007, "Dire Straits")
            };

            Assert.AreEqual(3, DataLambdaFilter.GetAllBands(albums).Count);
        }
Пример #2
0
        public void GetAllBandsStringsComparisonLambdaTest()
        {
            List <MusicAlbum> albums = new List <MusicAlbum>
            {
                new MusicAlbum("TestName", 200, 2200, "Pink Floyd"),
                new MusicAlbum("TestName", 200, 2100, "Pink Floyd"),
                new MusicAlbum("TestName", 200, 2000, "Pink Floyd"),
                new MusicAlbum("TestName", 201, 2005, "Pink Floyd"),
                new MusicAlbum("TestName", 202, 2006, "Metallica"),
                new MusicAlbum("TestName", 203, 2007, "Dire Straits")
            };

            var albumBands = DataLambdaFilter.GetAllBands(albums);

            Assert.AreEqual(1, (from album in albumBands where album.Contains("Pink Floyd") select album).Count());
        }