Created
January 28, 2012 11:37
-
-
Save benfoster/1694028 to your computer and use it in GitHub Desktop.
Inbound Route Tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestFixture] | |
public class PortfolioInboundRouteTests | |
{ | |
[SetUp] | |
public void SetUp() { | |
RouteTable.Routes.Clear(); | |
new PublicRouteRegistry().RegisterRoutes(RouteTable.Routes); | |
} | |
// Project Routes | |
[Test] | |
public void Projects_root() { | |
"~/projects".ShouldMapTo<ProjectsController>(x => x.List(1)); | |
} | |
[Test] | |
public void Projects_with_page() { | |
"~/projects/page/4".ShouldMapTo<ProjectsController>(x => x.List(4)); | |
} | |
[Test] | |
public void Projects_tagged() { | |
"~/projects/tagged/some-tag".ShouldMapTo<ProjectsController>(x => x.Tagged("some-tag", 1)); | |
} | |
[Test] | |
public void Projects_tagged_with_page() { | |
"~/projects/tagged/another-tag/page/5".ShouldMapTo<ProjectsController>(x => x.Tagged("another-tag", 5)); | |
} | |
[Test] | |
public void Projects_details() { | |
"~/projects/some-project".ShouldMapTo<ProjectsController>(x => x.Details("some-project", null)); | |
} | |
[Test] | |
[ExpectedException(typeof(MvcContrib.TestHelper.AssertionException))] | |
public void Projects_details_with_invalid_id() { | |
"~/projects/some%20project+".ShouldMapTo<ProjectsController>(x => x.Details("FAIL", null)); | |
} | |
[Test] | |
public void Projects_details_with_segments() { | |
"~/projects/archive/some-project".ShouldMapTo<ProjectsController>(x => x.Details("archive/some-project", null)); | |
} | |
[Test] | |
public void Projects_feed() { | |
"~/projects/feed".ShouldMapTo<ProjectsController>(x => x.Feed("")); | |
} | |
[Test] | |
public void Projects_feed_with_tag() { | |
"~/projects/feed/tagged/foo-bar".ShouldMapTo<ProjectsController>(x => x.Feed("foo-bar")); | |
} | |
[Test] | |
public void Projects_Tags() { | |
"~/projects/tags".ShouldMapTo<ProjectsController>(x => x.Tags((string)null)); | |
} | |
// categories | |
[Test] | |
public void Categories_details() { | |
"~/categories/some-category".ShouldMapTo<CategoriesController>(x => x.Details("some-category", 1)); | |
} | |
[Test] | |
[ExpectedException(typeof(MvcContrib.TestHelper.AssertionException))] | |
public void Categories_details_with_invalid_id() { | |
"~/categories/segment/some-category".ShouldMapTo<CategoriesController>(x => x.Details("FAIL", 1)); | |
} | |
[Test] | |
public void Categories_details_with_page() { | |
"~/categories/some-category/page/10".ShouldMapTo<CategoriesController>(x => x.Details("some-category", 10)); | |
} | |
[Test] | |
public void Categories_list() { | |
"~/categories/list".ShouldMapTo<CategoriesController>(x => x.List((string)null)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment