public async Task WebHost_Batching_WithSpecialCharactersInUrl() { // Arrange var handler = new SuccessMessageHandler(); var routeCollection = new HostedHttpRouteCollection(new RouteCollection(), "/"); routeCollection.Add("default", routeCollection.CreateRoute( "values/ space", defaults: null, constraints: null, dataTokens: null, handler: handler)); var configuration = new HttpConfiguration(routeCollection); var server = new HttpServer(configuration); var batchHandler = new DefaultHttpBatchHandler(server); var request = new HttpRequestMessage { Content = new MultipartContent("mixed") { new HttpMessageContent(new HttpRequestMessage(HttpMethod.Post, "http://contoso.com/values/ space")) } }; // Arrange var response = await batchHandler.ProcessBatchAsync(request, CancellationToken.None); // Assert Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.True(handler.IsCalled); }
public void to_dictionary_should_convert_route_collection_when_hosted_with_SystemX2EWeb() { // arrange var route = Mock.Of <IHttpRoute>(); var routes = new HostedHttpRouteCollection() { { "test", route }, }; // act var dictionary = routes.ToDictionary(); // assert dictionary.Should().BeEquivalentTo(new Dictionary <string, IHttpRoute>() { ["test"] = route }); }