Exemplo n.º 1
0
        public void Init()
        {
            var provider = new SampleAudioDramaProvider();

            _audioDramas = provider.Get().ToList();
            _searcher    = new AudioDramaSearcher();
        }
        public void TheFilterReturnsOnlyAudioDramasThatHaveANumber()
        {
            var provider = new SampleAudioDramaProvider();
            var filter   = new MainAudioDramasOnlyFilter();

            var filtered = filter.Filter(provider.Get().ToList()).ToList();

            Assert.IsTrue(filtered.All(x => x.AudioDramaDto.NumberEuropa.HasValue));
        }
Exemplo n.º 3
0
        public void TheFilterReturnsAllGivenAudioDramas()
        {
            var provider    = new SampleAudioDramaProvider();
            var audioDramas = provider.Get().ToList();
            var filter      = new AllAudioDramasFilter();

            var filtered = filter.Filter(audioDramas).ToList();

            CollectionAssert.AreEqual(audioDramas, filtered);
        }
Exemplo n.º 4
0
        public void TheSorterPutsAudioDramasMarkedAsFavoriteBeforeAudioDramasThatAreNot()
        {
            var provider     = new SampleAudioDramaProvider();
            var sorter       = new IsFavoriteFirstSorter();
            var audioDramas  = provider.Get().ToList();
            var expectedSort = audioDramas.OrderByDescending(x => x.AudioDramaUserData.IsFavorite).ToList();

            var sort = sorter.Sort(audioDramas).ToList();

            CollectionAssert.AreEqual(expectedSort, sort);
        }
        public void FilterOnlyReturnsOnlyAudioDramasThatDontHaveANumber()
        {
            var provider         = new SampleAudioDramaProvider();
            var audioDramas      = provider.Get().ToList();
            var expectedFiltered = audioDramas.Where(x => x.AudioDramaDto.NumberEuropa.HasValue == false).ToList();
            var filter           = new SpecialAudioDramasOnlyFilter();

            var filtered = filter.Filter(audioDramas).ToList();

            CollectionAssert.AreEqual(expectedFiltered, filtered);
        }
Exemplo n.º 6
0
        public void TheSorterSortsDescendingByReleaseDate_NewBeforeOld()
        {
            var provider     = new SampleAudioDramaProvider();
            var sorter       = new ReleaseDateDescendingSorter();
            var audioDramas  = provider.Get().ToList();
            var expectedSort = audioDramas.OrderByDescending(x => x.AudioDramaDto.ReleaseDate).ToList();

            var sort = sorter.Sort(audioDramas).ToList();

            CollectionAssert.AreEqual(expectedSort, sort);
        }
        public void TheSorterSortsTheAudioDramasDescendingByTheirNumber()
        {
            var provider     = new SampleAudioDramaProvider();
            var sorter       = new NumberDescendingSorter();
            var audioDramas  = provider.Get().ToList();
            var expectedSort = audioDramas.OrderByDescending(x => x.AudioDramaDto.NumberEuropa).ToList();

            var sort = sorter.Sort(audioDramas).ToList();

            CollectionAssert.AreEqual(expectedSort, sort);
        }
Exemplo n.º 8
0
        public void TheSorterPutsAudioDramasMarkedAsHeardBeneathUnheardAudioDramas()
        {
            var provider     = new SampleAudioDramaProvider();
            var sorter       = new HeardLastSorter();
            var audioDramas  = provider.Get().ToList();
            var expectedSort = audioDramas.OrderBy(x => x.AudioDramaUserData.Heard).ToList();

            var sort = sorter.Sort(audioDramas).ToList();

            CollectionAssert.AreEqual(expectedSort, sort);
        }
        public void TheSorterSortsTheAudioDramasAscendingByName()
        {
            var provider     = new SampleAudioDramaProvider();
            var sorter       = new NameAscendingSorter();
            var audioDramas  = provider.Get().ToList();
            var expectedSort = audioDramas.OrderBy(x => x.AudioDramaDto.Title).ToList();

            var sort = sorter.Sort(audioDramas).ToList();

            CollectionAssert.AreEqual(expectedSort, sort);
        }
Exemplo n.º 10
0
        public void TheSorterPutsHeardAudioDramasBeforeUnheardAudioDramas()
        {
            var provider     = new SampleAudioDramaProvider();
            var sorter       = new HeardFirstSorter();
            var audioDramas  = provider.Get().ToList();
            var expectedSort = audioDramas.OrderByDescending(x => x.AudioDramaUserData.Heard).ToList();

            var sort = sorter.Sort(audioDramas).ToList();

            CollectionAssert.AreEqual(expectedSort, sort);
        }
Exemplo n.º 11
0
        public void TheFilterReturnsOnlyAudioDramasThatAreMarkedAsFavorite()
        {
            var provider          = new SampleAudioDramaProvider();
            var audioDramas       = provider.Get().ToList();
            var filter            = new FavoritesOnlyFilter();
            var expectedFiltering = audioDramas.Where(x => x.AudioDramaUserData.IsFavorite).ToList();

            var filtered = filter.Filter(audioDramas).ToList();

            CollectionAssert.AreEqual(expectedFiltering, filtered);
        }
Exemplo n.º 12
0
        public void FilterReturnsOnlyUnheardAudioDramas()
        {
            var provider         = new SampleAudioDramaProvider();
            var audioDramas      = provider.Get().ToList();
            var expectedFiltered = audioDramas.Where(x => x.AudioDramaUserData.Heard == false).ToList();
            var filter           = new UnheardOnlyFilter();

            var filtered = filter.Filter(audioDramas).ToList();

            CollectionAssert.AreEqual(expectedFiltered, filtered);
        }
Exemplo n.º 13
0
        public void TheFilterReturnsOnlyAudioDramasWhereTheInterpreterIsDieDreiFragezeichen()
        {
            var provider    = new SampleAudioDramaProvider();
            var audioDramas = provider.Get().ToList();

            var audioDrama = audioDramas.First();

            audioDrama.AudioDramaDto.Interpreter = "Homer Simpson";

            var filter            = new DieDreiFrageichenOnlyFilter();
            var expectedFiltering = audioDramas.Where(x => x.AudioDramaDto.Interpreter == "Die drei ???").ToList();

            var filtered = filter.Filter(audioDramas).ToList();

            Assert.IsFalse(filtered.Contains(audioDrama));
            CollectionAssert.AreEqual(expectedFiltering, filtered);
        }
Exemplo n.º 14
0
        public void TheFilterReturnsOnlyAudioDramasWhereTheInterpreterIsDieDrei()
        {
            var provider    = new SampleAudioDramaProvider();
            var audioDramas = provider.Get().ToList();

            var audioDrama = audioDramas.First();

            audioDrama.AudioDramaDto.Interpreter = "DiE DR3i";

            var filter            = new DieDreiFilter();
            var expectedFiltering = audioDramas.Where(x => x.AudioDramaDto.Interpreter == "DiE DR3i").ToList();

            var filtered = filter.Filter(audioDramas).ToList();

            Assert.IsTrue(filtered.Contains(audioDrama));
            CollectionAssert.AreEqual(expectedFiltering, filtered);
        }