Пример #1
0
        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);
        }
Пример #2
0
        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;
            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);
        }