Exemplo n.º 1
0
        public void Test1()
        {
            string       requestText = @"
GET http://www.fish-web-demo.com/Pages/Demo/Authorize/Everyone.aspx HTTP/1.1
";
            IHttpHandler handler     = null;

            using (WebContext context = WebContext.FromRawText(requestText)) {
                IHttpHandlerFactory factory = new MvcPageHandlerFactory();
                handler = factory.GetHandler(context.HttpContext, "GET", null, null);

                // 下面这个调用没什么意义,只是为了覆盖代码
                factory.ReleaseHandler(handler);
            }
            Assert.IsNotNull(handler);

            object vkInfo   = handler.GetValue("InvokeInfo");
            object instance = vkInfo.GetValue("Instance");

            Assert.AreEqual(typeof(Controllers.AuthorizeTestController), instance.GetType());
        }