Пример #1
0
        public void CacheSemanticActorYearSearchTest()
        {
            MoviesRepository repo = new MoviesRepository();

            repo.ClearCache();

            var found1 = repo.SearchMovie(DataSourceType.TMDB.Description(), "terminator 2", "arnold", 1900, 2000);

            var found2 = repo.SearchMovie(DataSourceType.CACHE.Description(), "terminator 2", "arnold", 1900, 2000);

            Assert.IsTrue(found1.Count() == found2.Count());

            repo.ClearCache();
        }
Пример #2
0
        public void CacheClearTest()
        {
            MoviesRepository repo = new MoviesRepository();

            repo.ClearCache();

            var found1 = repo.SearchMovie(DataSourceType.YOUTUBE.Description(), "terminator 2", "", 0, 0);

            var found2 = repo.SearchMovie(DataSourceType.CACHE.Description(), "terminator 2", "", 0, 0);

            Assert.IsTrue((found1.Count() > 0) && (found2.Count() > 0));

            repo.ClearCache();
            found2 = repo.SearchMovie(DataSourceType.CACHE.Description(), "terminater", "", 0, 0);
            Assert.IsTrue(found2.Count() == 0);
        }
Пример #3
0
        public void TMDBSemanticOnlySearchTest()
        {
            MoviesRepository repo = new MoviesRepository();

            repo.ClearCache();
            var found = repo.SearchMovie(DataSourceType.TMDB.Description(), "terminator 2", "", 0, 0);

            Assert.IsTrue(found.Count() > 0);
        }
Пример #4
0
        public void YoutubeSearchTest()
        {
            MoviesRepository repo = new MoviesRepository();

            repo.ClearCache();
            var found = repo.SearchMovie(DataSourceType.YOUTUBE.Description(), "terminator 2", "", 0, 0);

            Assert.IsTrue(found.Count() > 0);
        }
Пример #5
0
        public void SimpleTMDBSearchTest() //FREQUENT TIME OUT EXCEPTION BECAUSE OF SLOW WEB API LOADING
        {
            MoviesRepository repo = new MoviesRepository();

            repo.ClearCache();
            var webdriver = new ChromeDriver();

            webdriver.Manage().Timeouts().AsynchronousJavaScript = new System.TimeSpan(TimeOut);
            var ngDriver = new NgWebDriver(webdriver);

            ngDriver.Url = BaseUrl;
            ngDriver.Manage().Window.Maximize();

            SelectElement selectBox = new SelectElement(ngDriver.FindElement(By.Id("selectDataSource")));

            foreach (var op in selectBox.Options)
            {
                if (op.Text == "TMDB")
                {
                    op.Click();
                    break;
                }
            }

            ngDriver.FindElement(NgBy.Model("dtFrom")).Clear();
            ngDriver.FindElement(NgBy.Model("dtFrom")).SendKeys("2000");

            ngDriver.FindElement(NgBy.Model("dtTo")).Clear();
            ngDriver.FindElement(NgBy.Model("dtTo")).SendKeys("2017");

            ngDriver.FindElement(By.Id("inputSearchMovies")).SendKeys("007");
            ngDriver.FindElement(By.Id("btnSearch")).Click();

            try
            {
                var title = ngDriver.FindElement(NgBy.Binding("movie.Title"))?.Text;
                Assert.IsTrue(!string.IsNullOrEmpty(title));
            }
            catch (Exception)
            {
                Assert.Fail();
            }
            finally
            {
                webdriver.Close();
            }
        }
Пример #6
0
        public void SimpleIntegratedSearchTest()
        {
            MoviesRepository repo = new MoviesRepository();

            repo.ClearCache();
            var webdriver = new ChromeDriver();

            webdriver.Manage().Timeouts().AsynchronousJavaScript = new System.TimeSpan(TimeOut);
            var ngDriver = new NgWebDriver(webdriver);

            ngDriver.Url = BaseUrl;
            ngDriver.Manage().Window.Maximize();

            SelectElement selectBox = new SelectElement(ngDriver.FindElement(By.Id("selectDataSource")));

            foreach (var op in selectBox.Options)
            {
                if (op.Text == "Integrated")
                {
                    op.Click();
                    break;
                }
            }

            ngDriver.FindElement(NgBy.Model("dtFrom")).Clear();
            ngDriver.FindElement(NgBy.Model("dtFrom")).SendKeys("2000");

            ngDriver.FindElement(NgBy.Model("dtTo")).Clear();
            ngDriver.FindElement(NgBy.Model("dtTo")).SendKeys("2016");

            ngDriver.FindElement(By.Id("inputSearchMovies")).SendKeys("terminator 2");
            ngDriver.FindElement(By.Id("inputSearchActor")).SendKeys("arnold");
            ngDriver.FindElement(By.Id("btnSearch")).Click();

            try
            {
                var title = ngDriver.FindElement(NgBy.Binding("movie.Title"))?.Text;
                Assert.IsTrue(!string.IsNullOrEmpty(title));
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }