Esempio n. 1
0
        public void InternetSearchIndexPostTest()
        {
            using (SearchContext searchContext = new SearchContext())
            {
                SearchEngine google = new SearchEngine()
                {
                    Name   = "Google",
                    Domain = "https://www.google.com",
                    URL    = "https://www.google.com/search?q="
                };
                SearchEngine bing = new SearchEngine()
                {
                    Name   = "Bing",
                    Domain = "https://www.bing.com",
                    URL    = "https://www.bing.com/search?q="
                };
                searchContext.SearchEngines.Add(google);
                searchContext.SearchEngines.Add(bing);
                searchContext.SaveChanges();
            }

            using (InternetSearchController internetSearchController = new InternetSearchController())
            {
                Task <ActionResult> task = internetSearchController.Search("Test");
                task.Wait();
                ActionResult actionResult = task.Result;
                ViewResult   viewResult   = actionResult as ViewResult;
                Assert.IsNotNull(viewResult);
                Assert.IsNotNull(viewResult.Model);
            }
        }
Esempio n. 2
0
 public void InternetSearchIndexPostEmptyDBTest()
 {
     using (InternetSearchController internetSearchController = new InternetSearchController())
     {
         Task <ActionResult> task = internetSearchController.Search("Test");
         task.Wait();
         ActionResult actionResult = task.Result;
         ViewResult   viewResult   = actionResult as ViewResult;
         Assert.IsNotNull(viewResult);
     }
 }