public void GetPathInfo () { StringWriter sw = new StringWriter (); SimpleWorkerRequest swr = new SimpleWorkerRequest ("appVirtualDir", cwd, "/pageVirtualPath", "querystring", sw); Assert.AreEqual ("/pageVirtualPath", swr.GetPathInfo (), "GetPathInfo-1"); swr = new SimpleWorkerRequest ("appVirtualDir", cwd, "/", "querystring", sw); Assert.AreEqual ("/", swr.GetPathInfo (), "GetPathInfo-2"); swr = new SimpleWorkerRequest ("appVirtualDir", cwd, "pageVirtualPath", "querystring", sw); Assert.AreEqual (String.Empty, swr.GetPathInfo (), "GetPathInfo-3"); }
public void Demo () { StringWriter sw = new StringWriter (); SimpleWorkerRequest swr = new SimpleWorkerRequest("file.aspx", "querystring", sw); Assert.AreEqual ("/appVirtualDir", swr.GetAppPath (), "T1"); Assert.AreEqual (cwd + Path.DirectorySeparatorChar, swr.GetAppPathTranslated (), "TRANS1"); Assert.AreEqual ("/appVirtualDir/file.aspx", swr.GetFilePath (), "T2"); Assert.AreEqual ("GET", swr.GetHttpVerbName (), "T3"); Assert.AreEqual ("HTTP/1.0", swr.GetHttpVersion (), "T4"); Assert.AreEqual ("127.0.0.1", swr.GetLocalAddress (), "T5"); Assert.AreEqual (80, swr.GetLocalPort (), "T6"); Assert.AreEqual ("querystring", swr.GetQueryString (), "T7"); Assert.AreEqual ("127.0.0.1", swr.GetRemoteAddress (), "T8"); Assert.AreEqual (0, swr.GetRemotePort (), "T9"); Assert.AreEqual ("/appVirtualDir/file.aspx?querystring", swr.GetRawUrl (), "T10"); Assert.AreEqual ("/appVirtualDir/file.aspx", swr.GetUriPath (), "T11"); Assert.AreEqual ("0", swr.GetUserToken ().ToString (), "T12"); Assert.AreEqual ("", swr.GetPathInfo (), "TRANS2"); // // On windows: // \windows\microsoft.net\framework\v1.1.4322\Config\machine.config // Assert.AreEqual (true, swr.MachineConfigPath != null, "T14"); // // On windows: // \windows\microsoft.net\framework\v1.1.4322 // Assert.AreEqual (true, swr.MachineInstallDirectory != null, "T15"); // Disabled T16. It throws a nullref on MS // Assert.AreEqual (Path.Combine (cwd, "file.aspx"), swr.GetFilePathTranslated (), "T16"); // Assert.AreEqual ("", swr.GetServerVariable ("AUTH_TYPE"), "T18"); Assert.AreEqual ("", swr.GetServerVariable ("AUTH_USER"), "T19"); Assert.AreEqual ("", swr.GetServerVariable ("REMOTE_USER"), "T20"); Assert.AreEqual ("", swr.GetServerVariable ("TERVER_SOFTWARE"), "T21"); Assert.AreEqual ("/appVirtualDir/file.aspx", swr.GetUriPath (), "T22"); // // MapPath // Assert.AreEqual (Path.Combine (cwd, "file.aspx"), swr.MapPath ("/appVirtualDir/file.aspx"), "TP2"); Assert.AreEqual (Path.Combine (cwd, "file.aspx"), swr.MapPath ("/appVirtualDir/file.aspx"), "TP4"); Assert.AreEqual (Path.Combine (cwd, Path.Combine ("Subdir", "file.aspx")), swr.MapPath ("/appVirtualDir/Subdir/file.aspx"), "TP5"); }
public void GetPathInfoTest() { SimpleWorkerRequest reference = new SimpleWorkerRequest("/webapp", "c:\\webapp\\", "default.aspx", "", null); AspNetWorker worker = GetHttpWorker("/webapp", "c:\\webapp\\"); Assert.AreEqual(reference.GetPathInfo(), worker.GetPathInfo()); }