diff options
| author | unknown <MKhan@.arcresources.ca> | 2009-07-26 14:30:28 -0600 |
|---|---|---|
| committer | unknown <MKhan@.arcresources.ca> | 2009-07-26 14:30:28 -0600 |
| commit | e4462b2ba85dceb9b500c4d926529d9b57626fce (patch) | |
| tree | e832baec5bb94f61a4bca9625129d5dbdcd70fff | |
| parent | fb097a2671e4de3a798de9096b670d85d23605af (diff) | |
built a stronly typed url buildermain
| -rw-r--r-- | product/gorilla.mvc/Url.cs | 2 | ||||
| -rw-r--r-- | product/gorilla.mvc/UrlHelpers.cs | 4 | ||||
| -rw-r--r-- | product/gorilla.mvc/UrlSpecs.cs (renamed from product/gorilla.mvc/when_building_a_url.cs) | 12 | ||||
| -rw-r--r-- | product/gorilla.mvc/gorilla.mvc.csproj | 3 |
4 files changed, 13 insertions, 8 deletions
diff --git a/product/gorilla.mvc/Url.cs b/product/gorilla.mvc/Url.cs index 28adcea..082f167 100644 --- a/product/gorilla.mvc/Url.cs +++ b/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; diff --git a/product/gorilla.mvc/UrlHelpers.cs b/product/gorilla.mvc/UrlHelpers.cs index 0667b24..d0004a6 100644 --- a/product/gorilla.mvc/UrlHelpers.cs +++ b/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 diff --git a/product/gorilla.mvc/when_building_a_url.cs b/product/gorilla.mvc/UrlSpecs.cs index 0f6a746..f63817c 100644 --- a/product/gorilla.mvc/when_building_a_url.cs +++ b/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 diff --git a/product/gorilla.mvc/gorilla.mvc.csproj b/product/gorilla.mvc/gorilla.mvc.csproj index f413f8a..217beed 100644 --- a/product/gorilla.mvc/gorilla.mvc.csproj +++ b/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. |
