Commit e4462b2

unknown <MKhan@.arcresources.ca>
2009-07-26 20:30:28
built a stronly typed url builder main
1 parent fb097a2
product/gorilla.mvc/gorilla.mvc.csproj
@@ -55,6 +55,7 @@
     <Reference Include="System.Core">
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
     </Reference>
+    <Reference Include="System.Web" />
     <Reference Include="System.Web.Abstractions">
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
     </Reference>
@@ -83,7 +84,7 @@
     <Compile Include="Url.cs" />
     <Compile Include="UrlBuilder.cs" />
     <Compile Include="UrlHelpers.cs" />
-    <Compile Include="when_building_a_url.cs" />
+    <Compile Include="UrlSpecs.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
product/gorilla.mvc/Url.cs
@@ -6,7 +6,7 @@ namespace gorilla.mvc
 {
     public class Url
     {
-        public static string To<Controller>(Expression<Action<Controller>> url) where Controller : IController
+        public static string to<Controller>(Expression<Action<Controller>> url) where Controller : IController
         {
             var expression = url.Body as MethodCallExpression;
             return null != expression ? new UrlBuilder().create_url_for<Controller>(expression) : string.Empty;
product/gorilla.mvc/UrlHelpers.cs
@@ -6,9 +6,9 @@ namespace gorilla.mvc
 {
     public static class UrlHelpers
     {
-        public static string To<Controller>(this UrlHelper helper, Expression<Action<Controller>> url) where Controller : IController
+        public static string to<Controller>(this UrlHelper helper, Expression<Action<Controller>> url) where Controller : IController
         {
-            return Url.To(url);
+            return Url.to(url);
         }
     }
 }
\ No newline at end of file
product/gorilla.mvc/when_building_a_url.cs → product/gorilla.mvc/UrlSpecs.cs
@@ -7,20 +7,24 @@ using developwithpassion.bdd.mbunit.standard.observations;
 
 namespace gorilla.mvc
 {
+    public class UrlSpecs
+    {
+    }
+
     [Concern(typeof (Url))]
     public class when_building_a_url : observations_for_a_static_sut
     {
         it should_build_a_url_with_no_parameters =
-            () => Url.To<TestController>(x => x.no_params()).should_be_equal_to(@"Test\no_params");
+            () => Url.to<TestController>(x => x.no_params()).should_be_equal_to(@"Test\no_params");
 
         it should_build_a_url_with_a_single_parameter =
-            () => Url.To<TestController>(x => x.single_param("mo")).should_be_equal_to(@"Test\single_param?name=mo");
+            () => Url.to<TestController>(x => x.single_param("mo")).should_be_equal_to(@"Test\single_param?name=mo");
 
         it should_build_a_url_with_multiple_parameters =
-            () => Url.To<TestController>(x => x.multiple_params(1001, "mo")).should_be_equal_to( @"Test\multiple_params?id=1001&name=mo");
+            () => Url.to<TestController>(x => x.multiple_params(1001, "mo")).should_be_equal_to( @"Test\multiple_params?id=1001&name=mo");
 
         it should_be_able_to_build_a_url_by_picking_off_a_property_from_another_type =
-            () => Url.To<TestController>(x => x.single_param(new {value = "chicken"}.value)).should_be_equal_to( @"Test\single_param?name=chicken");
+            () => Url.to<TestController>(x => x.single_param(new {value = "chicken"}.value)).should_be_equal_to( @"Test\single_param?name=chicken");
     }
 
     class TestController : Controller