Beispiel #1
0
        public HttpContextWrap(string appVirtualDir, string appPhysicalDir, string page, string url, string query, TextWriter output)
        {
            if (Directory.Exists(appPhysicalDir))
            {
                Thread.GetDomain().SetData(".appPath", appPhysicalDir);
            }
            else
            {
                Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            }

            if (!string.IsNullOrWhiteSpace(appVirtualDir))
            {
                string vpath = appVirtualDir.Trim('/') + "/";
                Thread.GetDomain().SetData(".appVPath", vpath);
            }
            else
            {
                Thread.GetDomain().SetData(".appVPath", "/");
            }

            Thread.GetDomain().SetData(".appDomain", "*");
            HttpRequest request = new HttpRequest(page, url, query);
            HttpResponse response = new HttpResponse(output);
            TestWorkerRequest wr = new TestWorkerRequest(page, query, output);
            httpContext = new HttpContext(wr);
        }
        public void ReadDalDataBaseSet_Test()
        {
            int count = 0;

            Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            Thread.GetDomain().SetData(".appVPath", "/");
            Thread.GetDomain().SetData(".appDomain", "*");


            AppDomain.CurrentDomain.SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            AppDomain.CurrentDomain.SetData(".appVPath", "/");
            AppDomain.CurrentDomain.SetData(".appDomain", "*");

            TextWriter tw = new StringWriter();

            TestWorkerRequest wr = new TestWorkerRequest("/appinternals", "", tw);
            wr.SetRemoteAddress("127.0.0.1");
            HttpContext.Current = new HttpContext(wr);


            MethodInfo methodInfo = typeof(AppInfo).GetMethod("ReadDalDataBaseSet", BindingFlags.NonPublic | BindingFlags.Static);

            var dataBaseSets = (List<Arch.CFramework.AppInfoCollection.AppInfo.DataBaseSet>)methodInfo.Invoke(null, null);

            count = dataBaseSets.Count;

            //  Assert.AreEqual(count, 2);
        }
Beispiel #3
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);

        }
        public void Init()
        {
            Thread.GetDomain().SetData(".appDomain", "*");
            Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            Thread.GetDomain().SetData(".appVPath", "/");
            TextWriter tw = new StringWriter();
            wr = new TestWorkerRequest("/appinternals", "", tw);
            wr.SetRemoteAddress("127.0.0.1");



        }
        public void SendAppInfo_Test()
        {

            Thread.GetDomain().SetData(".appDomain", "*");
            Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            Thread.GetDomain().SetData(".appVPath", "/");


            TextWriter tw = new StringWriter();

            TestWorkerRequest wr = new TestWorkerRequest("/appinternals", "", tw);
            wr.SetRemoteAddress("127.0.0.1");
            HttpContext.Current = new HttpContext(wr);

            AppInfo.SendAppInfo("www.test.com", "/", "80");

            Thread.Sleep(100);
        }
        public void Init()
        {
            Thread.GetDomain().SetData(".appDomain", "*");
            Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            Thread.GetDomain().SetData(".appVPath", "/");
            TextWriter tw = new StringWriter();

            wr = new TestWorkerRequest("/appinternals", "", tw);
            wr.SetRemoteAddress("127.0.0.1");
            HttpContext.Current = new HttpContext(wr);


            currentUser = new Mock<UserInfo>();
            authorization = new Mock<Authorization>();

            currentUser.SetupProperty(p => p.LoginTime, DateTime.Now);
            currentUser.SetupProperty(p => p.UserID, "xffan");

        }
        public void GetCurrent_Test()
        {
            Thread.GetDomain().SetData(".appDomain", "*");

            Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            Thread.GetDomain().SetData(".appVPath", "/");
            TextWriter tw = new StringWriter();

            TestWorkerRequest wr = new TestWorkerRequest("/appinternals", "", tw);
            wr.SetRemoteAddress("127.0.0.1");
            HttpContext.Current = new HttpContext(wr);

            try
            {
                AppInfo appInfo = AppInfo.GetCurrent();
            }
            catch (Exception)
            { }
        }
Beispiel #8
0
        public void RequestFilters_Test()
        {
            RequestFilters.RegisterFilter(new TestIRequestFilter());

            
            Thread.GetDomain().SetData(".appDomain", "*");
            Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            Thread.GetDomain().SetData(".appVPath", "/");
            TextWriter tw = new StringWriter();

            RequestFilters.ProcessRequest(HttpContext.Current);

            TestWorkerRequest wr = new TestWorkerRequest("/appinternals", "", tw);
            wr.SetRemoteAddress("127.0.0.1");
            HttpContext.Current = new HttpContext(wr);

            RequestFilters.ProcessRequest(HttpContext.Current);
            Assert.AreEqual(HttpContext.Current.Response.StatusCode, 200);

        }
        public void GetContextTest()
        {
            AppInernalsManager_Accessor target = new AppInernalsManager_Accessor(); // TODO: Initialize to an appropriate value
            string menu = string.Empty; // TODO: Initialize to an appropriate value
            ISerializer serializer = new HTMLSerializer(); // TODO: Initialize to an appropriate value
            string expected = string.Empty; // TODO: Initialize to an appropriate value
            HttpRequest request = new HttpRequest("~/", "http://localhost/test/appinternals/configurations/beans/appsettingsbean", "action=view");

            //HttpResponse response = new HttpResponse(new StringWriter());
            //HttpContext context = new HttpContext(request, response);
            //HttpContext.Current = context;


            Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            Thread.GetDomain().SetData(".appVPath", "/");
            Thread.GetDomain().SetData(".appDomain", "*");
            TextWriter tw = new StringWriter();
            TestWorkerRequest wr = new TestWorkerRequest("/test/appinternals/configurations/beans/appsettingsbean", "action=view", tw);
            wr.SetRemoteAddress("127.0.0.1");
            HttpContext.Current = new HttpContext(wr);
            string actual;
            actual = target.GetContext(menu, serializer);
            Assert.AreNotEqual(expected, actual);

        }
Beispiel #10
0
        public void LogIn_Test()
        {
            TextWriter tw = new StringWriter();

            wr = new TestWorkerRequest("/appinternals/logIn", "", tw);
            wr.SetRemoteAddress("127.0.0.1");
            HttpContext.Current = new HttpContext(wr);

            try
            {
                authorization.Object.LogIn();
            }
            catch (Exception ex)
            { }

        }
        public void GetMenusTest()
        {
            MenusContainer_Accessor target = new MenusContainer_Accessor(); // TODO: Initialize to an appropriate value
            ComponentCollection expected = null; // TODO: Initialize to an appropriate value
            ComponentCollection actual;
            //HttpRequest request = new HttpRequest("~/", "http://localhost/test/appinternals/configurations/beans/appsettingsbean", "action=view");

            //HttpResponse response = new HttpResponse(new StringWriter());
            //HttpContext context = new HttpContext(request, response);


            Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            Thread.GetDomain().SetData(".appVPath", "/");
            Thread.GetDomain().SetData(".appDomain", "*");
            TextWriter tw = new StringWriter();
            TestWorkerRequest wr = new TestWorkerRequest("/test/appinternals/configurations/beans/appsettingsbean", "", tw);
            wr.SetRemoteAddress("127.0.0.1");
            HttpContext.Current = new HttpContext(wr);

           // HttpContext.Current = context;
            actual = target.GetMenus();
            Assert.AreNotEqual(expected, actual);
            Assert.IsTrue(actual.Components.Count==6);
        }
Beispiel #12
0
        public void UrlTraceCollector_URL_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", "", tw);
            wr.SetRemoteAddress("127.0.0.1");
            HttpContext.Current = new HttpContext(wr);


            ConfigBeanManager.Current.Register(new UrlTraceItems());

            var traceContext = UrlTraceContext.Create();



            //开始Trace
            UrlTraceLogger.StartSpan(traceContext);
            //开始数据收集
            UrlTraceCollector.StartCollect(traceContext);

            UrlTraceCollector.EndColloct(traceContext);

            Assert.AreEqual(traceContext.TraceInfo.RawUrl, "//appinternals");
            Assert.AreEqual(traceContext.TraceInfo.HttpMethod, "Get");

        }
Beispiel #13
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);
        }
Beispiel #14
0
        public void CacheRefreshPresent_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/RefreshCache", "", tw);
            wr.SetRemoteAddress("127.0.0.1");

            HttpContext.Current = new HttpContext(wr);

            string name = typeof(Test1RefreshException).FullName.Replace(".", "-").ToLowerInvariant();
            string json = Arch.CFramework.CacheRefresh.Present.CacheRefreshPresent.Instance.RefreshCache(name, new CFramework.AppInternals.Serialization.JSONSerializer());


            var dyjson = DynamicJson.Parse(json);

            Assert.IsTrue(dyjson.IsDefined("Results"));


            string list = Arch.CFramework.CacheRefresh.Present.CacheRefreshPresent.Instance.ListView(new CFramework.AppInternals.Serialization.JSONSerializer());

            var dylist = DynamicJson.Parse(list);

            Assert.IsTrue(dylist.IsDefined("RefreshItems"));

        }
Beispiel #15
0
        public void UrlTraceCollector_Service_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", "", 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());

            var traceContext = UrlTraceContext.Create();



            //开始Trace
            UrlTraceLogger.StartSpan(traceContext);
            //开始数据收集
            UrlTraceCollector.StartCollect(traceContext);

            UrlTraceCollector.EndColloct(traceContext);

            Assert.AreEqual(traceContext.TraceInfo.RawUrl, "//appinternals");
            Assert.AreEqual(traceContext.TraceInfo.HttpMethod, "Get");



        }
Beispiel #16
0
        public void LogIn_Test1()
        {
            TextWriter tw = new StringWriter();

            wr = new TestWorkerRequest("/appinternals/logIn", "ticket=ST-8446-eCdNmuxCOLqAlsYUm4Ml-sso01.example.org", tw);
            wr.SetRemoteAddress("127.0.0.1");
            wr.SetQueryString("ticket=ST-8446-eCdNmuxCOLqAlsYUm4Ml-sso01.example.org");
            wr.SetCookie("ticket=ST-8446-eCdNmuxCOLqAlsYUm4Ml-sso01.example.org");
            HttpContext.Current = new HttpContext(wr);

            try
            {
                authorization.Object.LogIn();
            }
            catch (Exception ex)
            { }

        }
        public void DoComponetsContentTest()
        {
            AppInernalsManager_Accessor target = new AppInernalsManager_Accessor();
            string name = "buildinfo";
            string actual;
            //HttpRequest request = new HttpRequest("~/", "http://localhost/test/appinternals/components/buildinfo", "");

            //HttpResponse response = new HttpResponse(new StringWriter());
            //HttpContext context = new HttpContext(request, response);



            Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            Thread.GetDomain().SetData(".appVPath", "/");
            Thread.GetDomain().SetData(".appDomain", "*");
            TextWriter tw = new StringWriter();
            TestWorkerRequest wr = new TestWorkerRequest("/test/appinternals/components/buildinfo", "", tw);
            wr.SetRemoteAddress("127.0.0.1");

            HttpContext.Current = new HttpContext(wr);
            ISerializer serializer = new JSONSerializer();
            actual = target.DoComponetsContent(name, serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);
            serializer = new HTMLSerializer();
            actual = target.DoComponetsContent(name, serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);
            serializer = new XMLSerializer();
            actual = target.DoComponetsContent(name, serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);

        }
Beispiel #18
0
        public void UrlTraceContext_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", "", tw);
            wr.SetRemoteAddress("127.0.0.1");
            HttpContext.Current = new HttpContext(wr);

            ConfigBeanManager.Current.Register(new UrlTraceItems());
            UrlTraceContext urlTraceContext = UrlTraceContext.Create();
            string key = typeof(UrlTraceContext).FullName;
            Assert.AreEqual(UrlTraceContext.Current, HttpContext.Current.Items[key]);

        }
        public void DoLocalLogTest()
        {
            AppInernalsManager_Accessor target = new AppInernalsManager_Accessor(); // TODO: Initialize to an appropriate value
            string name = string.Empty;
            ISerializer serializer = new JSONSerializer(); // TODO: Initialize to an appropriate value
            string expected = string.Empty; // TODO: Initialize to an appropriate value
            //HttpRequest request = new HttpRequest("~/", "http://localhost/test/appinternals/locallog/iislog/123", "");

            //HttpResponse response = new HttpResponse(new StringWriter());
            //HttpContext context = new HttpContext(request, response);
            //HttpContext.Current = context;

            Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            Thread.GetDomain().SetData(".appVPath", "/");
            Thread.GetDomain().SetData(".appDomain", "*");
            TextWriter tw = new StringWriter();
            TestWorkerRequest wr = new TestWorkerRequest("test/appinternals/locallog/iislog/123", "", tw);
            wr.SetRemoteAddress("127.0.0.1");

            HttpContext.Current = new HttpContext(wr);

            string actual;
            actual = target.DoLocalLog(name, serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);
            name = "iislog";
            actual = target.DoLocalLog(name, serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);

            name = "applog";
            actual = target.DoLocalLog(name, serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);
        }
        public void DoFeatureContingencyEntityTest()
        {
            FeatureContingency.FCManager.Current.GetFCS();
            AppInernalsManager_Accessor target = new AppInernalsManager_Accessor(); // TODO: Initialize to an appropriate value
            //HttpRequest request = new HttpRequest("", "http://localhost/appinternals", "action=change");
            //HttpResponse response = new HttpResponse(new StringWriter());
            //HttpContext context = new HttpContext(request, response);
            //HttpContext.Current = context;

            Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            Thread.GetDomain().SetData(".appVPath", "/");
            Thread.GetDomain().SetData(".appDomain", "*");
            TextWriter tw = new StringWriter();
            TestWorkerRequest wr = new TestWorkerRequest("/appinternals", "action=change", tw);
            wr.SetRemoteAddress("127.0.0.1");

            HttpContext.Current = new HttpContext(wr);

            string name = "centrallogging";
            ISerializer serializer = new JSONSerializer(); // TODO: Initialize to an appropriate value
            string actual;
            actual = target.DoFeatureContingencyEntity(name, serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);

            //request = new HttpRequest("", "http://localhost/appinternals", "action=view");

            //context = new HttpContext(request, response);
            //HttpContext.Current = context;

            tw = new StringWriter();
            wr = new TestWorkerRequest("/appinternals", "action=view", tw);
            wr.SetRemoteAddress("127.0.0.1");


            actual = target.DoFeatureContingencyEntity(name, serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);
            //request = new HttpRequest("", "http://localhost/appinternals", "format=json");

            //context = new HttpContext(request, response);
            //HttpContext.Current = context;

            tw = new StringWriter();
            wr = new TestWorkerRequest("/appinternals", "format=json", tw);
            wr.SetRemoteAddress("127.0.0.1");

            actual = target.DoFeatureContingencyEntity(name, serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);
        }
        public void DoDefaultTest()
        {
            AppInernalsManager_Accessor target = new AppInernalsManager_Accessor(); // TODO: Initialize to an appropriate value
            ISerializer serializer = new HTMLSerializer();
            //HttpRequest request = new HttpRequest("~/", "http://localhost/test/appinternals/configurations/beans/appsettingsbean", "action=view");

            //HttpResponse response = new HttpResponse(new StringWriter());
            //HttpContext context = new HttpContext(request, response);
            //HttpContext.Current = context;

            Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            Thread.GetDomain().SetData(".appVPath", "/");
            Thread.GetDomain().SetData(".appDomain", "*");
            TextWriter tw = new StringWriter();
            TestWorkerRequest wr = new TestWorkerRequest("/test/appinternals/configurations/beans/appsettingsbean", "action=view", tw);
            wr.SetRemoteAddress("127.0.0.1");


            HttpContext.Current = new HttpContext(wr);

            string actual;
            actual = target.DoDefault(serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);
            serializer = new JSONSerializer();
            actual = target.DoDefault(serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);
        }
Beispiel #22
0
        public void   UrlTracer_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", "", 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());

         //   var traceContext = UrlTraceContext.Create();



            //开始Trace
           // UrlTraceLogger.StartSpan(traceContext);

            //traceContext.TraceInfo = new UrlTraceInfo()
            //{

            //    ClientAppId = "12",
            //    ClientIP = "127.0.0l1",
            //    FilePath = "\\",
            //    HostAddress = "127.0.0.1",
            //    HttpMethod = "Get",
            //    RawUrl = "\appinternals",
            //    RequestCost = 12,
            //    RequestSize = 12,
            //    RequestType = "text\\html",
            //    ResponseSize = 100,
            //    ResponseStatus = 200,
            //    TraceItems = new UrlTraceItems()

            //};

            //UrlTraceLogger.Log(traceContext);

            //UrlTraceLogger.EndSpan(traceContext);

            UrlTracer.Start();
            UrlTracer.End();

            string key = typeof(UrlTraceContext).FullName;
            Assert.AreEqual(UrlTraceContext.Current, HttpContext.Current.Items[key]);


        }
        public void UpdateConfigBeanTest()
        {
            AppInernalsManager_Accessor target = new AppInernalsManager_Accessor(); // TODO: Initialize to an appropriate value

            ConfigBeanBase configBean = null; // TODO: Initialize to an appropriate value
            IReader expected = null; // TODO: Initialize to an appropriate value
            //HttpRequest request = new HttpRequest("~/", "http://localhost/test/appinternals/configurations/beans/appsettingsbean", "action=view");

            //HttpResponse response = new HttpResponse(new StringWriter());
            //HttpContext context = new HttpContext(request, response);
            //HttpContext.Current = context;


            Thread.GetDomain().SetData(".appPath", AppDomain.CurrentDomain.BaseDirectory);
            Thread.GetDomain().SetData(".appVPath", "/");
            Thread.GetDomain().SetData(".appDomain", "*");
            TextWriter tw = new StringWriter();
            TestWorkerRequest wr = new TestWorkerRequest("test/appinternals/configurations/beans/appsettingsbean", "action=view", tw);
            wr.SetRemoteAddress("127.0.0.1");
            HttpContext.Current = new HttpContext(wr);
            IReader actual;
            HttpRequest request = HttpContext.Current.Request;
            actual = target.UpdateConfigBean(configBean, request);
            Assert.AreNotEqual(expected, actual);

        }
Beispiel #24
0
        public void Logout_1Test()
        {
            TextWriter tw = new StringWriter();

            wr = new TestWorkerRequest("/appinternals/logout", "", tw);
            wr.SetRemoteAddress("127.0.0.1");
            HttpContext.Current = new HttpContext(wr);

            wr.SetCookie("cfx_aurz=" + GenCookieVal());
            wr.SetHost("cms.fx.fws.qa.nt.ctripcorp.com");
            wr.SetRemoteAddress("172.16.144.2");

            try
            {
                authorization.Object.LogOut();

            }
            catch (Exception ex)
            { }
        }