예제 #1
0
        public void IndexTest()
        {
            ActionResultController controller = new ActionResultController();
            ActionResult           result     = controller.Index();

            Assert.NotNull(result);
        }
예제 #2
0
        public void HttpNotFoundResultTest()
        {
            var controller = new ActionResultController();
            var result     = controller.HttpNotFoundResult();

            Assert.IsType <HttpNotFoundResult>(result);
        }
예제 #3
0
        public void Redirect2RouteTest()
        {
            var controller = new ActionResultController();
            var result     = controller.Redirect2Route() as RedirectToRouteResult;

            Assert.Equal("", result.RouteName);
        }
예제 #4
0
        public void ScriptResultTest()
        {
            var controller = new ActionResultController();
            var result     = controller.ScriptResult() as JavaScriptResult;

            Assert.Equal("<script><alert>hi,welcome to .net</alert></script>", result.Script);
        }
예제 #5
0
        public void Redirect2ActionTest()
        {
            var controller = new ActionResultController();
            var result     = controller.Redirect2Action() as RedirectToRouteResult;

            Assert.NotNull(result);
        }
예제 #6
0
        public void EmptyActionTest()
        {
            var controller = new ActionResultController();
            var result     = controller.EmptyAction() as EmptyResult;

            Assert.NotNull(result);
        }
예제 #7
0
        public void PageTest()
        {
            ActionResultController controller = new ActionResultController();
            var result = controller.Page() as ContentResult;

            Assert.Equal("this is content", result.Content);
        }
예제 #8
0
        public void BaiduTest()
        {
            ActionResultController controller = new ActionResultController();
            var result = controller.Baidu() as RedirectResult;

            Assert.Equal("http://www.baidu.com", result.Url);
        }
예제 #9
0
        public void JsonResultTest()
        {
            var controller = new ActionResultController();
            var result     = controller.JsonResult() as JsonResult;
            var data       = new JsonObject("ActionResultController", "JsonResult");

            Assert.Equal(data.ToString(), result.Data.ToString());
        }