Created
September 26, 2012 16:26
-
-
Save mwrock/3789000 to your computer and use it in GitHub Desktop.
Testing UrlHelper.Route
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
var mockTeamFoundationFeatureAvailabilityService = new Mock<ITeamFoundationFeatureAvailabilityService>(); | |
var testable = new ApiFeatureAvailabilityController(x => mockTeamFoundationFeatureAvailabilityService.Object); | |
var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost:8080/path"); | |
var config = new HttpConfiguration(); | |
config.Routes.MapHttpRoute("FeatureAvailability", "path/{id}", new { Controller = "ApiFeatureAvailability", id = RouteParameter.Optional }); | |
request.Properties[HttpPropertyKeys.HttpConfigurationKey] = config; | |
request.Properties[HttpPropertyKeys.HttpRouteDataKey] = config.Routes.GetRouteData(request); | |
testable.Url = new UrlHelper(request); | |
testable.Request = request; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment