Skip to content

Commit

Permalink
#109 - removed support for specifying optional params with a leading …
Browse files Browse the repository at this point in the history
…question mark.
  • Loading branch information
mccalltd committed Aug 24, 2012
1 parent 4134c48 commit fd747e8
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 233 deletions.
18 changes: 0 additions & 18 deletions src/AttributeRouting.Specs/Features/RouteConstraints.feature
@@ -1,23 +1,5 @@
Feature: Route Constraints

Scenario: Regex route constraints specified inline
# MVC
Given I have registered the routes for the RouteConstraintsController
When I fetch the routes for the RouteConstraints controller's InlineConstraints action
Then the route url is "InlineConstraints/{number}/{word}/{alphanum}/{capture}"
Then the parameter "number" is constrained by the pattern "\d+"
Then the parameter "word" is constrained by the pattern "\w{2}"
Then the parameter "alphanum" is constrained by the pattern "[A-Za-z0-9]*"
Then the parameter "capture" is constrained by the pattern "(gotcha)"
# Web API
Given I have registered the routes for the HttpRouteConstraintsController
When I fetch the routes for the HttpRouteConstraints controller's InlineConstraints action
Then the route url is "InlineConstraints/{number}/{word}/{alphanum}/{capture}"
Then the parameter "number" is constrained by the pattern "\d+"
Then the parameter "word" is constrained by the pattern "\w{2}"
Then the parameter "alphanum" is constrained by the pattern "[A-Za-z0-9]*"
Then the parameter "capture" is constrained by the pattern "(gotcha)"

Scenario Outline: Inline constraints
# MVC
Given I have registered the routes for the InlineRouteConstraintsController
Expand Down
113 changes: 36 additions & 77 deletions src/AttributeRouting.Specs/Features/RouteConstraints.feature.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions src/AttributeRouting.Specs/Features/RouteDefaults.feature
Expand Up @@ -18,12 +18,8 @@ Scenario: Route default specified inline

Scenario: Optional parameters specified with a url parameter token
When I fetch the routes for the RouteDefaults controller's Optionals action
Then the route url is "Optionals/{p1}/{p2}/{p3}"
Then the route url is "Optionals/{p1}"
And the parameter "p1" is optional
And the parameter "p2" is optional
And the parameter "p3" is optional
When I fetch the routes for the HttpRouteDefaults controller's Optionals action
Then the route url is "Optionals/{p1}/{p2}/{p3}"
Then the route url is "Optionals/{p1}"
And the parameter "p1" is optional
And the parameter "p2" is optional
And the parameter "p3" is optional
14 changes: 3 additions & 11 deletions src/AttributeRouting.Specs/Features/RouteDefaults.feature.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/AttributeRouting.Specs/Subjects/BugFixesController.cs
@@ -1,14 +1,13 @@
using System;
using System.Web.Mvc;
using AttributeRouting.Web;
using System.Web.Mvc;
using AttributeRouting.Web.Mvc;

namespace AttributeRouting.Specs.Subjects
{
[RoutePrefix("BugFixes")]
public class BugFixesController : Controller
{
[GET("Gallery/_CenterImage/{?guid_Gallery}/{?slideShow}/{?currentController}/{?image}")]
[GET("Gallery/_CenterImage/{guid_Gallery?}/{slideShow?}/{currentController?}/{image?}")]
public ActionResult Issue43_OptionalParamsAreMucky(Guid? guid_Gallery, bool? slideShow, string currentController, string image)
{
return Content("I'm fixed!");
Expand Down
Expand Up @@ -11,8 +11,8 @@ public string InlineDefaults()
return "";
}

[GET("Optionals/{p1?}/{?p2}/{?p3?}")]
public string Optionals(string p1, string p2, string p3)
[GET("Optionals/{p1?}")]
public string Optionals(string p1)
{
return "";
}
Expand Down
36 changes: 18 additions & 18 deletions src/AttributeRouting.Specs/Subjects/RouteDefaultsController.cs
@@ -1,20 +1,20 @@
using System.Web.Mvc;
using AttributeRouting.Web.Mvc;

namespace AttributeRouting.Specs.Subjects
{
public class RouteDefaultsController : Controller
{
[GET("InlineDefaults/{hello=sun}/{goodnight=moon}")]
public ActionResult InlineDefaults()
{
return Content("");
}

[GET("Optionals/{p1?}/{?p2}/{?p3?}")]
public ActionResult Optionals(string p1, string p2, string p3)
{
return Content("");
}
}
using AttributeRouting.Web.Mvc;

namespace AttributeRouting.Specs.Subjects
{
public class RouteDefaultsController : Controller
{
[GET("InlineDefaults/{hello=sun}/{goodnight=moon}")]
public ActionResult InlineDefaults()
{
return Content("");
}

[GET("Optionals/{p1?}")]
public ActionResult Optionals(string p1)
{
return Content("");
}
}
}

0 comments on commit fd747e8

Please sign in to comment.