Пример #1
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);
        }
Пример #2
0
        public void DoFeatureContingencyEntityTest()
        {
            FeatureContingency.FeatureContingencyManager.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;
            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;
            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;
            actual = target.DoFeatureContingencyEntity(name, serializer);
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Length > 0);
        }