示例#1
0
        public void DataCacheTests_GetAllEntries()
        {
            IMovieData movieData = new DummyMovieData();
            IDataCache dataCache = new DataCache(movieData);

            var movies = dataCache.GetAllEntries();

            Console.WriteLine(JsonConvert.SerializeObject(movies));
        }
示例#2
0
        public void DataCacheTests_DeleteMovie()
        {
            IMovieData movieData = new DummyMovieData();
            IDataCache dataCache = new DataCache(movieData);

            dataCache.DeleteEntry(DummyMovies.SingleMovie.imdbID);

            Console.WriteLine();
        }
示例#3
0
        public void DataCacheTests_EditEntry()
        {
            IMovieData movieData = new DummyMovieData();
            IDataCache dataCache = new DataCache(movieData);

            dataCache.EditEntry(DummyMovies.SingleMovie.imdbID, DummyMovies.SingleMovie);

            Console.WriteLine();
        }
示例#4
0
        public void DataCacheTests_AddNewEntry()
        {
            IMovieData movieData = new DummyMovieData();
            IDataCache dataCache = new DataCache(movieData);

            dataCache.AddNewEntry(DummyMovies.NewMovie);

            Console.WriteLine();
        }
示例#5
0
        public void MovieLogicTests_PutCachedMovieExisting()
        {
            IOMDbConnection omdbConnection = new DummyOMDbCon();
            IDataCache      dataCache      = new DummyDataCache();
            IMovieData      movieData      = new DummyMovieData();

            IMovieLogic movieLogic = new MovieLogic(omdbConnection, dataCache, movieData);

            movieLogic.PutCachedMovie("00000", DummyMovies.NewMovie);

            Console.WriteLine();
        }
示例#6
0
        public void MovieLogicTests_GetCachedMovies()
        {
            IOMDbConnection omdbConnection = new DummyOMDbCon();
            IDataCache      dataCache      = new DummyDataCache();
            IMovieData      movieData      = new DummyMovieData();

            IMovieLogic movieLogic = new MovieLogic(omdbConnection, dataCache, movieData);

            var movies = movieLogic.GetCachedMovies();

            Console.WriteLine(JsonConvert.SerializeObject(movies));
        }
示例#7
0
        public void MovieLogicTests_SearchMoviesByTitleAndYear()
        {
            IOMDbConnection omdbConnection = new DummyOMDbCon();
            IDataCache      dataCache      = new DummyDataCache();
            IMovieData      movieData      = new DummyMovieData();

            IMovieLogic movieLogic = new MovieLogic(omdbConnection, dataCache, movieData);

            var movie = movieLogic.SearchMoviesByTitle("Movie1", "1990").Result;

            Console.WriteLine(JsonConvert.SerializeObject(movie));
        }
示例#8
0
        public void MovieLogicTests_SearchMoviesByID()
        {
            IOMDbConnection omdbConnection = new DummyOMDbCon();
            IDataCache      dataCache      = new DummyDataCache();
            IMovieData      movieData      = new DummyMovieData();

            IMovieLogic movieLogic = new MovieLogic(omdbConnection, dataCache, movieData);

            var movie = movieLogic.SearchMoviesByID("00000").Result;

            Console.WriteLine("");
        }
示例#9
0
        public void MovieLogicTests_DelCachedMovie()
        {
            IOMDbConnection omdbConnection = new DummyOMDbCon();
            IDataCache      dataCache      = new DummyDataCache();
            IMovieData      movieData      = new DummyMovieData();

            IMovieLogic movieLogic = new MovieLogic(omdbConnection, dataCache, movieData);

            movieLogic.DelCachedMovie("00000");

            Console.WriteLine();
        }
示例#10
0
        public void DataCacheTests_AddOldEntry()
        {
            IMovieData movieData = new DummyMovieData();
            IDataCache dataCache = new DataCache(movieData);

            try
            {
                dataCache.AddNewEntry(DummyMovies.SingleMovie);
            }
            catch (Exception ex)
            {
                if (ex.Message != "Movie allready in cache.")
                {
                    throw ex;
                }
            }

            Console.WriteLine();
        }