add few HttpRequest.MapPath tests
authorAndrew Skiba <andrews@mono-cvs.ximian.com>
Wed, 5 Jul 2006 16:21:48 +0000 (16:21 -0000)
committerAndrew Skiba <andrews@mono-cvs.ximian.com>
Wed, 5 Jul 2006 16:21:48 +0000 (16:21 -0000)
svn path=/trunk/mcs/; revision=62271

mcs/class/System.Web/ChangeLog
mcs/class/System.Web/Makefile
mcs/class/System.Web/Test/System.Web/ChangeLog
mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs

index 9178d31223706b3eb3526a4918f363224206b262..22f50fb81cac1e9a896966a70b98b3960f509087 100644 (file)
@@ -1,3 +1,7 @@
+2006-07-05  Andrew Skiba <andrews@mainsoft.com>
+
+       * Makefile: add NunitWeb resources to 1.1 profile
+
 2006-07-02  Vladimir Krasnov <vladimirk@mainsoft.com>
 
        * System.Web_test.dll.sources: added FakeMembershipProvider.cs for 
index e025c2fffca12749526c56fb6d892023863047b2..85973f9e4e0a85a92a99b4b8fcb60456fb7b9779 100644 (file)
@@ -84,11 +84,10 @@ TEST_RESOURCE_FILES = \
        Test/mainsoft/NunitWebResources/Web.sitemap \
        Test/mainsoft/MainsoftWebTest/nunitweb_config.xml 
 
-NUNIT_RESOURCE_FILES = 
+NUNIT_RESOURCE_FILES = $(TEST_RESOURCE_FILES)
 ifeq (net_2_0, $(PROFILE))
 OTHER_RES += $(RESOURCE_FILES_2)
 OTHER_LIB_MCS_FLAGS = -nowarn:618 -r:System.Configuration.dll
-NUNIT_RESOURCE_FILES = $(TEST_RESOURCE_FILES)
 endif
 
 LIB_MCS_FLAGS = \
index 2fc7e23de77914c09b657f6d43b801dcb972b115..76d897cdf8a49d477e8f2404a458e9195e67c1a9 100644 (file)
@@ -1,3 +1,7 @@
+2006-07-05  Andrew Skiba <andrews@mainsoft.com>
+
+       * HttpRequestTest: add MapPath tests
+
 2006-06-21  Sebastien Pouliot  <sebastien@ximian.com>
 
        * HttpWriter.cs: Fix test fixture not to inherit from 
index a6f14af1feb919f56a3bfcfe49e60c648b86d96b..6ce9b17da55d6b409f74d05653a75f9664e17393 100644 (file)
@@ -33,6 +33,8 @@ using System.Web;
 using System.Collections.Specialized;
 using NUnit.Framework;
 using System.Diagnostics;
+using MonoTests.SystemWeb.Framework;
+using System.IO;
 
 namespace MonoTests.System.Web {
 
@@ -138,7 +140,37 @@ namespace MonoTests.System.Web {
 
                        HttpRequest r = new HttpRequest ("file", url, qs);
                        Assert.AreEqual("\u00e4", r.QueryString["umlaut"]);
-               }       
+               }
+               [Test]
+               [Category("aaa")]
+               public void Test_MapPath ()
+               {
+                       WebTest t = new WebTest (new HandlerInvoker (new HandlerDelegate (
+                               MapPathDelegate)));
+                       t.Run ();
+               }
+
+               static public void MapPathDelegate ()
+               {
+                       HttpRequest r = HttpContext.Current.Request;
+                       string appBase = r.PhysicalApplicationPath.TrimEnd (Path.DirectorySeparatorChar);
+                       Assert.AreEqual (appBase, r.MapPath ("~"), "test1");
+                       Assert.AreEqual (appBase, r.MapPath ("/NunitWeb"), "test1.1");
+                       Assert.AreEqual (Path.Combine (appBase, "Web.config"),
+                               r.MapPath ("Web.config"), "test2");
+                       Assert.AreEqual (Path.Combine (appBase, "Web.config"),
+                               r.MapPath ("~/Web.config"), "test3");
+                       Assert.AreEqual (Path.Combine (appBase, "Web.config"),
+                               r.MapPath ("/NunitWeb/Web.config"), "test4");
+                       Assert.AreEqual (Path.Combine (appBase, "Web.config"),
+                               r.MapPath ("Web.config", null, false), "test5");
+                       Assert.AreEqual (Path.Combine (appBase, "Web.config"),
+                               r.MapPath ("Web.config", "", false), "test6");
+                       Assert.AreEqual (Path.Combine (appBase, "Web.config"),
+                               r.MapPath ("Web.config", "/NunitWeb", false), "test7");
+                       Assert.AreEqual (Path.Combine (appBase, "Web.config"),
+                               r.MapPath ("/NunitWeb/Web.config", "/NunitWeb", false), "test8");
+               }
        }
        
 
@@ -884,6 +916,7 @@ namespace MonoTests.System.Web {
                {
                        Assert.AreEqual("b\xE1r", context.Request.Form["foo"]);
                }
+
        }
 }