public void Verify_SortedDictionary_GenreFirstLoads()
        {
            MovieSortedDictionaryRepo mr = new MovieSortedDictionaryRepo();
            mr.Init(MockMovieList, FirstField.Genre);

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

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

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

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

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

            Assert.Equal(2, MovieList.Count);
        }
Example #3
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);
        }