예제 #1
0
        public void Requestdata_Test()
        {

            Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            Thread.GetDomain().SetData(".appVPath", "/");
            Thread.GetDomain().SetData(".appDomain", "*");
            TextWriter tw = new StringWriter();
            TestWorkerRequest wr = new TestWorkerRequest("/appinternals", "xhow=1&n=requestdata", tw);
            wr.SetRemoteAddress("127.0.0.1");


            Dictionary<string, string> header = new Dictionary<string, string>();
            header.Add("Tracing-RequestType", "Tracing-RequestType");

            wr.SetCustomRequestHeaders(header);
            HttpContext.Current = new HttpContext(wr);

            HttpContext.Current.Request.RequestContext.RouteData = new RouteData();

            HttpContext.Current.Request.RequestContext.RouteData.Values.Add("controller", "test");
            HttpContext.Current.Request.RequestContext.RouteData.Values.Add("action", "test");
            HttpContext.Current.Request.RequestContext.RouteData.DataTokens.Add("area", "area");


            ConfigBeanManager.Current.Register(new UrlTraceItems());
            object obj = new object();

            Showdialog showdialog = new Showdialog(HttpContext.Current);
            showdialog.IsOpen = true;
            HttpContext.Current.Items[obj] = showdialog;
            HttpContext.Current.Items[showdialog.Obj] = showdialog.ModelID;
            Freeway.Listening.LogListener.Instance.Callback += showdialog.TraceCallBack;


            UrlTracer.Start();

            UrlTracer.End();

            ShowdialogModel model;
            ShowdialogModelStore.Instance.TryGet(out model, HttpContext.Current);

            string requestId = model.RequestId;
            Dictionary<string,string> par=new Dictionary<string,string>();
            par.Add("requestId",requestId);

            TestWorkerRequest.SetQuery(HttpContext.Current, par);

            ResourceRouteHandler resourceRouteHandler = new ResourceRouteHandler();
            IHttpHandler httpHandler = resourceRouteHandler.GetHttpHandler(HttpContext.Current.Request.RequestContext);

            httpHandler.ProcessRequest(HttpContext.Current);

            Assert.IsTrue(tw.ToString().IndexOf("glimpse.data.initMetadata") > 0);

        }
예제 #2
0
        public void Sdg_Test()
        {

            Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            Thread.GetDomain().SetData(".appVPath", "/");
            Thread.GetDomain().SetData(".appDomain", "*");
            TextWriter tw = new StringWriter();
            TestWorkerRequest wr = new TestWorkerRequest("/appinternals", "xhow=1&n=Sdg_sprite", tw);
            wr.SetRemoteAddress("127.0.0.1");

            Dictionary<string, string> header = new Dictionary<string, string>();
            header.Add("Tracing-RequestType", "Tracing-RequestType");

            wr.SetCustomRequestHeaders(header);
            HttpContext.Current = new HttpContext(wr);

            ResourceRouteHandler resourceRouteHandler = new ResourceRouteHandler();
            IHttpHandler httpHandler = resourceRouteHandler.GetHttpHandler(HttpContext.Current.Request.RequestContext);
            httpHandler.ProcessRequest(HttpContext.Current);
            Assert.IsTrue(tw.ToString().Length > 0);
        }