コード例 #1
0
ファイル: ControllerTests.cs プロジェクト: betlgtu/Search
 public void SearchEngineCreateGetTest()
 {
     using (SearchEngineController searchEngineController = new SearchEngineController())
     {
         ActionResult actionResult = searchEngineController.Create();
         ViewResult   viewResult   = actionResult as ViewResult;
         Assert.IsNotNull(viewResult);
     }
 }
コード例 #2
0
ファイル: ControllerTests.cs プロジェクト: betlgtu/Search
        public void SearchEngineCreatePostTest()
        {
            using (SearchEngineController searchEngineController = new SearchEngineController())
            {
                SearchEngine google = new SearchEngine()
                {
                    Name   = "Google",
                    Domain = "https://www.google.com",
                    URL    = "https://www.google.com/search?q="
                };

                Task <ActionResult> task = searchEngineController.Create(google);
                task.Wait();
                ActionResult          actionResult          = task.Result;
                RedirectToRouteResult redirectToRouteResult = actionResult as RedirectToRouteResult;
                Assert.IsNotNull(redirectToRouteResult);
                Assert.IsTrue(google.Id > 0);
            }
        }