This file contains hidden or 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
[TestFixtureSetUp] | |
public void Setup() | |
{ | |
MvcApplication.RegisterRoutes(RouteTable.Routes); | |
} | |
[Test] | |
public void Should_map_People_url_to_people_with_default_action() | |
{ | |
"~/people".Route().ShouldMapTo<PeopleController>(x => x.Index()); |
This file contains hidden or 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
public interface IApiResource | |
{ | |
void SetLocation(ResourceLocation location); | |
} | |
public class ResourceLocation | |
{ | |
public Uri Location { get; private set; } |
This file contains hidden or 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
public class Contact : IApiResource | |
{ | |
public int Id { get; set; } | |
// ... other Contact Members | |
public SetLocation(ResourceLocation location) | |
{ | |
location.Location = new Uri("http://api.contoso.com/contacts/"+Id); | |
} | |
} |
This file contains hidden or 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
public SetLocation(ResourceLocation location) | |
{ | |
location.SetIn<ContactsController>(x => x.Get(Id)); | |
} |
This file contains hidden or 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
public string Route( | |
string routeName, | |
IDictionary<string, Object> routeValues | |
) |
This file contains hidden or 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
System.NotSupportedException was caught | |
Message=This operation is only supported by directly calling it on 'RouteCollection'. | |
Source=System.Web.Http.WebHost | |
StackTrace: | |
at System.Web.Http.WebHost.Routing.HostedHttpRouteCollection.GetEnumerator() | |
at WebApiContrib.Internal.RoutingHelper.GetUriFor(RouteValueDictionary routeValues, HttpControllerContext controllerContext) in C:\dev\WebAPIContrib\src\WebApiContrib\Internal\RoutingHelper.cs:line 42 | |
InnerException: |
This file contains hidden or 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
public HttpResponseMessage<Contact> Post(Contact contact) | |
{ | |
this.repository.Post(contact); | |
return new CreateResponse<Contact>(contact, this.ControllerContext); | |
} |
This file contains hidden or 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
public interface IApiResource { | |
void SetLocation(ResourceLocation resourceLocation); | |
void SetTransitions(ResourceTransitions transitions); | |
} | |
public class Order : IApiResource { | |
public int Id { get; set; } | |
// other resource members ... |
This file contains hidden or 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
Microsoft (R) Build Engine Version 4.0.30319.1 | |
[Microsoft .NET Framework, Version 4.0.30319.261] | |
Copyright (C) Microsoft Corporation 2007. All rights reserved. | |
System.Web.Razor -> C:\dev\aspnetwebstack\bin\Release\System.Web.Razor.dll | |
System.Web.WebPages.Deployment -> C:\dev\aspnetwebstack\bin\Release\System.Web.WebPages.Deployment.dll | |
WebMatrix.Data -> C:\dev\aspnetwebstack\bin\Release\WebMatrix.Data.dll | |
Microsoft.TestCommon -> C:\dev\aspnetwebstack\bin\Release\Test\Microsoft.TestCommon.dll | |
System.Json -> C:\dev\aspnetwebstack\bin\Release\System.Json.dll | |
System.Net.Http.Formatting -> C:\dev\aspnetwebstack\bin\Release\System.Net.Http.Formatting.dll |
This file contains hidden or 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
Microsoft (R) .NET Framework Strong Name Utility Version 4.0.30319.1 | |
Copyright (c) Microsoft Corporation. All rights reserved. | |
Assembly/Strong Name Users | |
=========================================== | |
Microsoft.TestCommon,31bf3856ad364e35 All users | |
Microsoft.Web.Helpers,31bf3856ad364e35 All users | |
Microsoft.Web.Helpers.Test,31bf3856ad364e35 All users | |
Microsoft.Web.Http.Data,31bf3856ad364e35 All users |