Пример #1
0
        public void DoConfigBeanTest()
        {
            AppInernalsManager_Accessor target = new AppInernalsManager_Accessor(); // 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 name = "beans";
            string actual;
            ISerializer serializer = new XMLSerializer();
            actual = target.DoConfigBean(name, serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);


            //   request = new HttpRequest("~/", "http://localhost/test/appinternals/configurations/files/app", "action=view");
            // HttpContext.Current = new HttpContext(request, response);

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

            HttpContext.Current = new HttpContext(wr);

            name = "files";
            actual = target.DoConfigBean(name, serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);
        }
Пример #2
0
        public void DoConfigBeanTest()
        {
            AppInernalsManager_Accessor target = new AppInernalsManager_Accessor(); // 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;

            string name = "beans";
            string actual;
            ISerializer serializer = new XMLSerializer();
            actual = target.DoConfigBean(name, serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);
            request = new HttpRequest("~/", "http://localhost/test/appinternals/configurations/files/app", "action=view");
            HttpContext.Current = new HttpContext(request, response);
            
            name = "files";
            actual = target.DoConfigBean(name, serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);
        }