Example #1
0
        public void CanGetQueryString()
        {
            HttpSimulator simulator = new HttpSimulator();

            simulator.SimulateRequest(new Uri("http://localhost/Test.aspx?param1=value1&param2=value2&param3=value3"));
            for (int i = 1; i <= 3; i++)
            {
                Assert.AreEqual("value" + i, HttpContext.Current.Request.QueryString["param" + i], "Could not find query string field 'param{0}'", i);
            }

            simulator.SimulateRequest(new Uri("http://localhost/Test.aspx?param1=new-value1&param2=new-value2&param3=new-value3&param4=new-value4"));
            for (int i = 1; i <= 4; i++)
            {
                Assert.AreEqual("new-value" + i, HttpContext.Current.Request.QueryString["param" + i], "Could not find query string field 'param{0}'", i);
            }

            simulator.SimulateRequest(new Uri("http://localhost/Test.aspx?"));
            Assert.AreEqual(string.Empty, HttpContext.Current.Request.QueryString.ToString());
            Assert.AreEqual(0, HttpContext.Current.Request.QueryString.Count);

            simulator.SimulateRequest(new Uri("http://localhost/Test.aspx"));
            Assert.AreEqual(string.Empty, HttpContext.Current.Request.QueryString.ToString());
            Assert.AreEqual(0, HttpContext.Current.Request.QueryString.Count);

            simulator.SimulateRequest(new Uri("http://localhost/Test.aspx?param-name"));
            Assert.AreEqual("param-name", HttpContext.Current.Request.QueryString.ToString());
            Assert.AreEqual(1, HttpContext.Current.Request.QueryString.Count);
            Assert.IsNull(HttpContext.Current.Request.QueryString["param-name"]);
        }
Example #2
0
        public void AddCycleTestSad()
        {
            using (HttpSimulator simulator = new HttpSimulator())
            {
                simulator.SimulateRequest();
                JIC.Base.TestStat t = JIC.Repositories.DBInteractions.Utitlities.Transe(JIC.Crime.Repositories.DBInteractions.DBFactory.Get(), () =>
                {
                    var serv = new JIC.Services.Services.CourtConfigurationService(Base.CaseType.Crime);
                    serv.AddCycle(new List <DateTime> {
                        DateTime.Now.AddDays(1), DateTime.Now.AddDays(3), DateTime.Now.AddDays(3), DateTime.Now.AddDays(4)
                    }, Base.Cycle.FirstCycle, 1);
                    return(Base.TestStat.Pass);
                });
                switch (t)
                {
                case Base.TestStat.Fail:
                    Assert.AreEqual(1, 1);
                    break;

                case Base.TestStat.Pass:
                    Assert.Fail();
                    break;

                default:
                    break;
                }
            }
        }
Example #3
0
        public void CanSimulateFormPost()
        {
            using (var simulator = new HttpSimulator())
            {
                var form = new NameValueCollection();
                form.Add("Test1", "Value1");
                form.Add("Test2", "Value2");
                simulator.SimulateRequest(new Uri("http://localhost/Test.aspx"), form);

                Assert.AreEqual("Value1", simulator.Context.Request.Form["Test1"]);
                Assert.AreEqual("Value2", simulator.Context.Request.Form["Test2"]);
                Assert.AreEqual(new Uri("http://localhost/Test.aspx"), simulator.Context.Request.Url);
            }

            using (var simulator = new HttpSimulator())
            {
                simulator.SetFormVariable("Test1", "Value1")
                .SetFormVariable("Test2", "Value2")
                .SimulateRequest(new Uri("http://localhost/Test.aspx"));

                Assert.AreEqual("Value1", simulator.Context.Request.Form["Test1"]);
                Assert.AreEqual("Value2", simulator.Context.Request.Form["Test2"]);
                Assert.AreEqual(new Uri("http://localhost/Test.aspx"), simulator.Context.Request.Url);
            }
        }
Example #4
0
        public void CanGetLocalPathCorrectly(string url, string appPath, string expectedLocalPath)
        {
            HttpSimulator simulator = new HttpSimulator(appPath, @"c:\inetpub\wwwroot\AppPath\");

            simulator.SimulateRequest(new Uri(url));
            Assert.AreEqual(expectedLocalPath, HttpContext.Current.Request.Path);
            Assert.AreEqual(expectedLocalPath, HttpContext.Current.Request.Url.LocalPath);
        }
Example #5
0
 public void Simulator_Assigns_CurrentContext()
 {
     using (HttpSimulator simulator = new HttpSimulator())
     {
         simulator.SimulateRequest();
         Assert.IsNotNull(HttpContext.Current);
     }
 }
Example #6
0
 public void CanGetSetCookies()
 {
     using (var simulator = new HttpSimulator())
     {
         simulator.SimulateRequest(new Uri("http://localhost/Test.aspx"), HttpVerb.POST);
         simulator.Context.Response.Cookies.Add(new HttpCookie("a", "b"));
         Assert.AreEqual("b", HttpContext.Current.Response.Cookies["a"].Value);
     }
 }
Example #7
0
 public void CanSimulateUserAgent()
 {
     using (var simulator = new HttpSimulator()) {
         var headers = new NameValueCollection();
         headers.Add("User-Agent", "Agent1");
         simulator.SimulateRequest(new Uri("http://localhost/Test.aspx"), HttpVerb.POST, headers);
         Assert.AreEqual("Agent1", simulator.Context.Request.UserAgent);
     }
 }
Example #8
0
        public void CanGetResponse()
        {
            HttpSimulator simulator = new HttpSimulator();

            simulator.SimulateRequest();
            HttpContext.Current.Response.Write("Hello World!");
            HttpContext.Current.Response.Flush();
            Assert.AreEqual("Hello World!", simulator.ResponseText);
        }
 public void InitializeContext()
 {
     using (HttpSimulator simulator = new HttpSimulator())
     {
         simulator.SimulateRequest(new Uri("http://localhost/"));
         HttpContext.Current.Application.Add(GlobalConstants.UrlSaltKeyName, HttpContextSalt);
         this.httpContext = HttpContext.Current;
     }
 }
Example #10
0
 public void CanDispose()
 {
     using (HttpSimulator simulator = new HttpSimulator())
     {
         simulator.SimulateRequest();
         Assert.IsNotNull(HttpContext.Current);
     }
     Assert.IsNull(HttpContext.Current);
 }
Example #11
0
    public static void SimulateRequestAndOwinContext(this HttpSimulator simulator)
    {
        simulator.SimulateRequest();
        Dictionary <string, object> owinEnvironment = new Dictionary <string, object>()
        {
            { "owin.RequestBody", null }
        };

        HttpContext.Current.Items.Add("owin.Environment", owinEnvironment);
    }
Example #12
0
        public void CanSimulateMapPath()
        {
            using (var simulator = new HttpSimulator())
            {
                simulator.SimulateRequest(new Uri("http://localhost/Test.aspx"));

                Assert.AreEqual("c:\\InetPub\\wwwRoot\\test\\test.js", simulator.Context.Server.MapPath("~/test/test.js"));
                Assert.AreEqual("c:\\InetPub\\wwwRoot\\test.js", simulator.Context.Server.MapPath("test.js"));
            }
        }
Example #13
0
        public void CanSetApplicationPathCorrectly(string url, string appPath, string expectedAppPath)
        {
            HttpSimulator simulator = new HttpSimulator(appPath, @"c:\inetpub\wwwroot\site1\test");

            Assert.AreEqual(expectedAppPath, simulator.ApplicationPath);
            simulator.SimulateRequest(new Uri(url));
            Assert.AreEqual(expectedAppPath, HttpContext.Current.Request.ApplicationPath);
            Assert.AreEqual(expectedAppPath, HttpRuntime.AppDomainAppVirtualPath);
            Assert.AreEqual(expectedAppPath, HostingEnvironment.ApplicationVirtualPath);
        }
Example #14
0
 public void CanSimulateBrowser()
 {
     using (var simulator = new HttpSimulator())
     {
         simulator.SetBrowser("browser", "IE");
         simulator.SimulateRequest(new Uri("http://localhost/Test.aspx"), HttpVerb.GET);
         Assert.NotNull(HttpContext.Current.Request.Browser);
         Assert.AreEqual("IE", HttpContext.Current.Request.Browser.Capabilities["browser"]);
     }
 }
Example #15
0
 public void CanSimulateCookie()
 {
     using (var simulator = new HttpSimulator())
     {
         var headers = new NameValueCollection();
         headers.Add("Cookie", "Cookie1=Value1");
         simulator.SimulateRequest(new Uri("http://localhost/Test.aspx"), HttpVerb.POST, headers);
         Assert.AreEqual("Value1", HttpContext.Current.Request.Cookies["Cookie1"].Value);
     }
 }
Example #16
0
 public void CanSimulateFormGetWithQueryString()
 {
     using (var simulator = new HttpSimulator())
     {
         var form = new NameValueCollection();
         form.Add("Test1", "Value1");
         form.Add("Test2", "Value2");
         simulator.SimulateRequest(new Uri("http://localhost/Test.aspx?Test1=Value1&Test2=Value2"));
         Assert.AreEqual(form, simulator.Context.Request.QueryString);
     }
 }
Example #17
0
 public void CanSimulateResponseHeaders()
 {
     using (var simulator = new HttpSimulator())
     {
         simulator.SimulateRequest(new Uri("http://localhost/Test.aspx"), HttpVerb.GET);
         HttpContext.Current.Response.AppendHeader("X-Content-Security-Policy", "frame-ancestors 'self'");
         HttpContext.Current.Response.Flush();
         Assert.IsNotEmpty(simulator.ResponseHeaders);
         Assert.That(simulator.ResponseHeaders, Contains.Substring("X-Content-Security-Policy: frame-ancestors 'self'"));
     }
 }
Example #18
0
        public void CanGetReferer()
        {
            HttpSimulator simulator = new HttpSimulator();

            simulator.SetReferer(new Uri("http://example.com/Blah.aspx")).SimulateRequest();
            Assert.AreEqual(new Uri("http://example.com/Blah.aspx"), HttpContext.Current.Request.UrlReferrer);

            simulator = new HttpSimulator();
            simulator.SimulateRequest().SetReferer(new Uri("http://x.example.com/Blah.aspx"));
            Assert.AreEqual(new Uri("http://x.example.com/Blah.aspx"), HttpContext.Current.Request.UrlReferrer);
        }
Example #19
0
 public void Should_Cache_item_in_HttpContext_Items()
 {
     using (var simulatedContext = new HttpSimulator())
     {
         var key      = "abc";
         var expected = "XYZ";
         simulatedContext.SimulateRequest(new Uri("http://abc.com"));
         HttpContext.Current.CacheInRequest(key, expected);
         var actual = HttpContext.Current.Items[key];
         actual.ShouldBe(expected);
     }
 }
Example #20
0
        public void CanSimulateSession()
        {
            using (var simulator = new HttpSimulator())
            {
                simulator.SimulateRequest(new Uri("http://localhost/Test.aspx"));

                Assert.IsNotNull(simulator.Context.Session.SessionID);
                simulator.Context.Session.Add("item", "value");
                Assert.AreEqual(1, simulator.Context.Session.Count);
                Assert.AreEqual("value", simulator.Context.Session["item"]);
            }
        }
Example #21
0
        public void CanSimulateRequest(string url, string appPath, string physicalPath, string expectedHost, int expectedPort, string expectedAppPath, string expectedLocalPath, string expectedPhysicalPath)
        {
            HttpSimulator simulator = new HttpSimulator(appPath, physicalPath);

            simulator.SimulateRequest(new Uri(url));

            Assert.AreEqual(expectedHost, HttpContext.Current.Request.Url.Host);
            Assert.AreEqual(expectedPort, HttpContext.Current.Request.Url.Port);
            Assert.AreEqual(expectedAppPath, HttpContext.Current.Request.ApplicationPath);
            Assert.AreEqual(expectedPhysicalPath, HttpContext.Current.Request.PhysicalApplicationPath);
            Assert.AreEqual(expectedLocalPath, HttpContext.Current.Request.Url.LocalPath);
        }
Example #22
0
 public void CanDisableWritingDebugInfoToConsole()
 {
     using (var console = new ConsoleCapture())
     {
         using (var simulator = new HttpSimulator())
         {
             simulator.DebugWriter = TextWriter.Null;
             simulator.SimulateRequest();
             Assert.IsEmpty(console.Out.ToString(), "Console.Out output");
         }
     }
 }
Example #23
0
 public void Should_Retrieve_Item_from_Cache()
 {
     using (var simulatedContext = new HttpSimulator())
     {
         var key      = "abc";
         var expected = "XYZ";
         simulatedContext.SimulateRequest(new Uri("http://abc.com"));
         HttpContext.Current.CacheInRequest(key, expected);
         var actual = HttpContext.Current.RetrieveFromRequestCache <string>(key);
         actual.ShouldBe(expected);
     }
 }
Example #24
0
        public void CanSetAppPhysicalPathCorrectly(string url, string appPath, string appPhysicalPath, string expectedPhysicalAppPath, string expectedPhysicalPath)
        {
            HttpSimulator simulator = new HttpSimulator(appPath, appPhysicalPath);

            Assert.AreEqual(expectedPhysicalAppPath, simulator.PhysicalApplicationPath);
            simulator.SimulateRequest(new Uri(url), HttpVerb.GET);

            Assert.AreEqual(expectedPhysicalPath, simulator.PhysicalPath);
            Assert.AreEqual(expectedPhysicalAppPath, HttpRuntime.AppDomainAppPath);
            Assert.AreEqual(expectedPhysicalAppPath, HostingEnvironment.ApplicationPhysicalPath);
            Assert.AreEqual(expectedPhysicalPath, HttpContext.Current.Request.PhysicalPath);
        }
Example #25
0
 public void Should_Not_Try_To_Add_Item_If_Already_In_Cache()
 {
     using (var simContext = new HttpSimulator())
     {
         var key      = "abc";
         var expected = "XYZ";
         simContext.SimulateRequest(new Uri("http://yes.com"));
         HttpContext.Current.CacheInRequest(key, expected);
         HttpContext.Current.CacheInRequest(key, expected);
         var actual = HttpContext.Current.Items[key];
         actual.ShouldBe(expected);
     }
 }
Example #26
0
 public void Should_SetValue_in_HttpContext()
 {
     using (var simulatedContext = new HttpSimulator())
     {
         var key      = "testKey";
         var expected = "Some Text";
         simulatedContext.SimulateRequest();
         var contextStorage = new HttpContextStorage(MockRepository.GenerateStub <IContextStorage>());
         contextStorage.SetValue(key, expected);
         var actual = HttpContext.Current.Items[key];
         actual.ShouldBe(expected);
     }
 }
Example #27
0
        public void GetUserDataTest()
        {
            UserData userData = null;

            using (HttpSimulator simulator = new HttpSimulator())
            {
                simulator.SimulateRequest(new Uri("http://localhost:8080"));
                HttpContext.Current.ApplicationInstance = new HttpApplication();
                Utils.Users = new ConcurrentDictionary <string, UserData>();
                Utils.Users.TryAdd("application_id", new UserData());
                userData = Utils.GetUserData("application_id");
            }
            Assert.IsNotNull(userData);
        }
Example #28
0
        public void CanSimulateIdentity()
        {
            var id = new WindowsIdentity(WindowsIdentity.GetCurrent().Token,
                                         "Negotiate", WindowsAccountType.Normal, true);

            using (var simulator = new HttpSimulator())
            {
                simulator.SetIdentity(id);
                simulator.SimulateRequest(new Uri("http://localhost/Test.aspx"), HttpVerb.GET);
                Assert.NotNull(HttpContext.Current.Request.LogonUserIdentity);
                Assert.AreEqual("Negotiate", HttpContext.Current.Request.LogonUserIdentity.AuthenticationType);
                Assert.IsNotEmpty(HttpContext.Current.Request.LogonUserIdentity.Name);
            }
        }
Example #29
0
        public void CanWriteDebugInfoToSpecifiedWriter()
        {
            using (var debugWriter = new StringWriter())
            {
                using (var simulator = new HttpSimulator())
                {
                    simulator.DebugWriter = debugWriter;

                    simulator.SimulateRequest();

                    Assert.IsNotNullOrEmpty(debugWriter.ToString(), "Debug output");
                }
            }
        }
        private static void SimulateHttpRequest(Action <SentryRequest> test)
        {
            using (var simulator = new HttpSimulator())
            {
                simulator.SetFormVariable("Form1", "Value1");
                simulator.SetHeader("UserAgent", "SharpRaven");
                simulator.SetCookie("Cookie", "Monster");

                using (simulator.SimulateRequest())
                {
                    var request = SentryRequest.GetRequest();
                    test.Invoke(request);
                }
            }
        }
Example #31
0
        private static void SimulateHttpRequest(Action <JsonPacket> test)
        {
            using (var simulator = new HttpSimulator())
            {
                simulator.SetFormVariable("Form1", "Value1")
                .SetCookie("Cookie1", "Value1")
                .SetHeader("Header1", "Value1")
                .SetReferer(new Uri("http://getsentry.com/"));

                using (simulator.SimulateRequest())
                {
                    var json = new JsonPacket(Guid.NewGuid().ToString("n"));
                    test.Invoke(json);
                }
            }
        }
 ////[Test]
 public void CanDispose()
 {
     using (var simulator = new HttpSimulator())
     {
         simulator.SimulateRequest();
         Assert.IsNotNull(HttpContext.Current);
     }
     Assert.IsNull(HttpContext.Current);
 }
        //[RowTest]
        ////[Row("/", "/", @"c:\inetpub\wwwroot\")]
        ////[Row("/Test/Test.aspx", "/", @"c:\inetpub\wwwroot\Test\Test.aspx")]
        ////[Row("/Test/Blah/Test.aspx", "/", @"c:\inetpub\wwwroot\Test\Blah\Test.aspx")]
        ////[Row("/Test", "/Test", @"c:\inetpub\wwwroot")]
        ////[Row("/Test/", "/Test", @"c:\inetpub\wwwroot\")]
        public void CanMapPath(string virtualPath, string appPath, string expectedMapPath)
        {
            var url = new Uri("http://localhost/Test/Test.aspx");
            var simulator = new HttpSimulator(appPath, @"c:\inetpub\wwwroot\");
            simulator.SimulateRequest(url);

            //Create a virtual path object.
            var vpath = ReflectionHelper.Instantiate("System.Web.VirtualPath, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", new[] { typeof(string) }, virtualPath);
            Assert.IsNotNull(vpath);

            var environment = HttpSimulatorTester.CallGetEnvironment();

            var vpathString = ReflectionHelper.InvokeProperty<string>(vpath, "VirtualPathString");
            var appVirtPath = ReflectionHelper.GetPrivateInstanceFieldValue<object>("_appVirtualPath", environment);
            Assert.IsNotNull(appVirtPath);
            Console.WriteLine("VPATH: " + vpath);
            Console.WriteLine("App-VPATH: " + appVirtPath);

            Console.WriteLine("vpath.VirtualPathString == '{0}'", vpathString);

            var mapping = ReflectionHelper.InvokeNonPublicMethod<string>(typeof(HostingEnvironment), "GetVirtualPathToFileMapping", vpath);
            Console.WriteLine("GetVirtualPathToFileMapping: --->{0}<---", (mapping ?? "{NULL}"));

            var o = ReflectionHelper.GetPrivateInstanceFieldValue<object>("_configMapPath", environment);
            Console.WriteLine("_configMapPath: {0}", o ?? "{null}");


            var mappedPath = ReflectionHelper.InvokeNonPublicMethod<string>(environment, "MapPathActual", vpath, false);
            Console.WriteLine("MAPPED: " + mappedPath);
            Assert.AreEqual(expectedMapPath, HttpContext.Current.Request.MapPath(virtualPath));
        }
        //[RowTest]
        //////[Row("http://*****:*****@"c:\InetPub\wwwRoot\")]
        //////[Row("http://*****:*****@"c:\InetPub\wwwRoot\", "localhost", 60653, "/", "/Test.aspx", @"c:\InetPub\wwwRoot\")]
        //////[Row("http://*****:*****@"c:\InetPub\wwwRoot\", "localhost", 60653, "/", "/Test/Test.aspx", @"c:\InetPub\wwwRoot\")]
        //////[Row("http://*****:*****@"c:\InetPub\wwwRoot\AppPath\", "localhost", 60653, "/AppPath", "/AppPath/Test.aspx", @"c:\InetPub\wwwRoot\AppPath\")]
        //////[Row("http://*****:*****@"c:\InetPub\wwwRoot\AppPath\", "localhost", 60653, "/AppPath", "/AppPath/Test.aspx", @"c:\InetPub\wwwRoot\AppPath\")]
        public void CanSimulateRequest(string url, string appPath, string physicalPath, string expectedHost, int expectedPort, string expectedAppPath, string expectedLocalPath, string expectedPhysicalPath)
        {
            var simulator = new HttpSimulator(appPath, physicalPath);
            simulator.SimulateRequest(new Uri(url));

            Assert.AreEqual(expectedHost, HttpContext.Current.Request.Url.Host);
            Assert.AreEqual(expectedPort, HttpContext.Current.Request.Url.Port);
            Assert.AreEqual(expectedAppPath, HttpContext.Current.Request.ApplicationPath);
            Assert.AreEqual(expectedPhysicalPath, HttpContext.Current.Request.PhysicalApplicationPath);
            Assert.AreEqual(expectedLocalPath, HttpContext.Current.Request.Url.LocalPath);
        }
 //[RowTest]
 ////[Row("http://localhost/AppPath/default.aspx", "/AppPath", "/AppPath/default.aspx")]
 ////[Row("http://localhost/AppPath/default.aspx", "/", "/AppPath/default.aspx")]
 public void CanGetLocalPathCorrectly(string url, string appPath, string expectedLocalPath)
 {
     var simulator = new HttpSimulator(appPath, @"c:\inetpub\wwwroot\AppPath\");
     simulator.SimulateRequest(new Uri(url));
     Assert.AreEqual(expectedLocalPath, HttpContext.Current.Request.Path);
     Assert.AreEqual(expectedLocalPath, HttpContext.Current.Request.Url.LocalPath);
 }
       // //[Test]
        public void CanGetReferer()
        {
            var simulator = new HttpSimulator();
            simulator.SetReferer(new Uri("http://example.com/Blah.aspx")).SimulateRequest();
            Assert.AreEqual(new Uri("http://example.com/Blah.aspx"), HttpContext.Current.Request.UrlReferrer);

            simulator = new HttpSimulator();
            simulator.SimulateRequest().SetReferer(new Uri("http://x.example.com/Blah.aspx"));
            Assert.AreEqual(new Uri("http://x.example.com/Blah.aspx"), HttpContext.Current.Request.UrlReferrer);
        }
 // //[Test]
  public void CanGetResponse()
  {
      var simulator = new HttpSimulator();
      simulator.SimulateRequest();
      HttpContext.Current.Response.Write("Hello World!");
      HttpContext.Current.Response.Flush();
      Assert.AreEqual("Hello World!", simulator.ResponseText);
  }
       // //[Test]
        public void CanSimulateFormPost()
        {
            using (var simulator = new HttpSimulator())
            {
                var form = new NameValueCollection {{"Test1", "Value1"}, {"Test2", "Value2"}};
                simulator.SimulateRequest(new Uri("http://localhost/Test.aspx"), form);

                Assert.AreEqual("Value1", HttpContext.Current.Request.Form["Test1"]);
                Assert.AreEqual("Value2", HttpContext.Current.Request.Form["Test2"]);
            }

            using (var simulator = new HttpSimulator())
            {
                simulator.SetFormVariable("Test1", "Value1")
                    .SetFormVariable("Test2", "Value2")
                    .SimulateRequest(new Uri("http://localhost/Test.aspx"));

                Assert.AreEqual("Value1", HttpContext.Current.Request.Form["Test1"]);
                Assert.AreEqual("Value2", HttpContext.Current.Request.Form["Test2"]);
            }
        }
        ////[Test]
        public void CanGetQueryString()
        {
            var simulator = new HttpSimulator();
            simulator.SimulateRequest(new Uri("http://localhost/Test.aspx?param1=value1&param2=value2&param3=value3"));
            for (var i = 1; i <= 3; i++)
                Assert.AreEqual("value" + i, HttpContext.Current.Request.QueryString["param" + i], "Could not find query string field 'param{0}'", i);

            simulator.SimulateRequest(new Uri("http://localhost/Test.aspx?param1=new-value1&param2=new-value2&param3=new-value3&param4=new-value4"));
            for (var i = 1; i <= 4; i++)
                Assert.AreEqual("new-value" + i, HttpContext.Current.Request.QueryString["param" + i], "Could not find query string field 'param{0}'", i);

            simulator.SimulateRequest(new Uri("http://localhost/Test.aspx?"));
            Assert.AreEqual(string.Empty, HttpContext.Current.Request.QueryString.ToString());
            Assert.AreEqual(0, HttpContext.Current.Request.QueryString.Count);

            simulator.SimulateRequest(new Uri("http://localhost/Test.aspx"));
            Assert.AreEqual(string.Empty, HttpContext.Current.Request.QueryString.ToString());
            Assert.AreEqual(0, HttpContext.Current.Request.QueryString.Count);
            
            simulator.SimulateRequest(new Uri("http://localhost/Test.aspx?param-name"));
            Assert.AreEqual("param-name", HttpContext.Current.Request.QueryString.ToString());
            Assert.AreEqual(1, HttpContext.Current.Request.QueryString.Count);
            Assert.IsNull(HttpContext.Current.Request.QueryString["param-name"]);
        }
        /*//[RowTest]
        ////[Row("http://localhost/Test/default.aspx", "/Test", @"c:\projects\test", @"c:\projects\test\", @"c:\projects\test\default.aspx")]
        ////[Row("http://localhost/Test/Subtest/default.aspx", "/Test", @"c:\projects\test", @"c:\projects\test\", @"c:\projects\test\Subtest\default.aspx")]
        ////[Row("http://localhost/test/default.aspx", "/", @"c:\inetpub\wwwroot\", @"c:\inetpub\wwwroot\", @"c:\inetpub\wwwroot\test\default.aspx")]
        ////[Row("http://localhost/test/default.aspx", "/", @"c:\inetpub\wwwroot", @"c:\inetpub\wwwroot\", @"c:\inetpub\wwwroot\test\default.aspx")]*/
        public void CanSetAppPhysicalPathCorrectly(string url, string appPath, string appPhysicalPath, string expectedPhysicalAppPath, string expectedPhysicalPath)
        {
            var simulator = new HttpSimulator(appPath, appPhysicalPath);
            Assert.AreEqual(expectedPhysicalAppPath, simulator.PhysicalApplicationPath);
            simulator.SimulateRequest(new Uri(url), HttpVerb.GET);

            Assert.AreEqual(expectedPhysicalPath, simulator.PhysicalPath);
            Assert.AreEqual(expectedPhysicalAppPath, HttpRuntime.AppDomainAppPath);
            Assert.AreEqual(expectedPhysicalAppPath, HostingEnvironment.ApplicationPhysicalPath);
            Assert.AreEqual(expectedPhysicalPath, HttpContext.Current.Request.PhysicalPath);
        }
 /*//[RowTest]
 ////[Row("http://localhost/Test/Default.aspx", "/Test", "/Test")]
 ////[Row("http://localhost/Test/Default.aspx", "/Test/", "/Test")]
 ////[Row("http://localhost/Test/Default.aspx", "//Test//", "/Test")]
 ////[Row("http://localhost/Test/Subtest/Default.aspx", "/Test", "/Test")]
 ////[Row("http://localhost/Test/Subtest/Default.aspx", "/Test/", "/Test")]
 ////[Row("http://localhost/Test/Subtest/Default.aspx", "//Test//", "/Test")]
 ////[Row("http://localhost/Test/Default.aspx", "", "/")]
 ////[Row("http://localhost/Test/Default.aspx", "/", "/")]
 ////[Row("http://localhost/Test/Default.aspx", null, "/")]*/
 public void CanSetApplicationPathCorrectly(string url, string appPath, string expectedAppPath)
 {
     var simulator = new HttpSimulator(appPath, @"c:\inetpub\wwwroot\site1\test");
     Assert.AreEqual(expectedAppPath, simulator.ApplicationPath);
     simulator.SimulateRequest(new Uri(url));
     Assert.AreEqual(expectedAppPath, HttpContext.Current.Request.ApplicationPath);
     Assert.AreEqual(expectedAppPath, HttpRuntime.AppDomainAppVirtualPath);
     Assert.AreEqual(expectedAppPath, HostingEnvironment.ApplicationVirtualPath);
 }