public void Verify_DictionaryGrossCnt()
        {
            MovieDictionaryRepo mr = new MovieDictionaryRepo();
            mr.Init(MockMovieList, FirstField.Genre);

            Assert.NotNull(mr.MoneyGrossDictionary);
            Assert.Equal(2, mr.FindMoviesInGrossReceiptRange(1000, 1999));
        }
        public void Verify_Dictionary_GenreFirstLoads()
        {
            MovieDictionaryRepo mr = new MovieDictionaryRepo();
            mr.Init(MockMovieList, FirstField.Genre);

            mr.DictionaryByGenreThenYear.TryGetValue("Drama:Western", out Dictionary<long, List<Movie>> yearDict);

            yearDict.TryGetValue(2016, out List<Movie> MovieList);

            Assert.Equal(2, MovieList.Count);
        }
        public void Verify_Dictionary_YearFirstLoads()
        {
            MovieDictionaryRepo mr = new MovieDictionaryRepo();
            mr.Init(MockMovieList, FirstField.Year);

            Dictionary<string, List<Movie>> genreDict;
            mr.DictionaryByYearThenGenre.TryGetValue(2016, out genreDict);

            List<Movie> MovieList;
            genreDict.TryGetValue("Drama:Western", out MovieList);

            Assert.Equal(2, MovieList.Count);
        }
Esempio n. 4
0
        public static IMovieRepo Repo(Type rt)
        {
            IMovieRepo returnRepo;

            switch (rt)
            {
            case Type.Dictionary:
                returnRepo = new MovieDictionaryRepo();
                break;

            case Type.SortedDictionary:
                returnRepo = new MovieSortedDictionaryRepo();
                break;

            case Type.SearchTree:
                returnRepo = new MovieC5SearchTreeRepo();
                break;

            case Type.Lookup:
                returnRepo = new MovieLookupRepo();
                break;

            case Type.BinarySearchTree:
                returnRepo = new MovieBinaryTreeRepo(MovieBinaryTreeRepo.BinaryTreeType.BinaryTree);
                break;

            case Type.RedBlackBinaryTree:
                returnRepo = new MovieBinaryTreeRepo(MovieBinaryTreeRepo.BinaryTreeType.RedBlackBinaryTree);
                break;

            case Type.BTree:
                returnRepo = new MovieBTreeRepo();
                break;

            case Type.LinqList:
                returnRepo = new MovieListLinqRepo();
                break;

            case Type.LinqParList:
                returnRepo = new MovieListLinqParallel();
                break;

            default:
                throw new Exception("RepoType: " + rt.ToString() + "Not Implemented");
            }

            return(returnRepo);
        }