forked from aspnet/AspNetWebStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpRouteTest.cs
More file actions
29 lines (27 loc) · 1.01 KB
/
Copy pathHttpRouteTest.cs
File metadata and controls
29 lines (27 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Net.Http;
using Microsoft.TestCommon;
namespace System.Web.Http.Routing
{
public class HttpRouteTest
{
[Theory]
[InlineData("123 456")]
[InlineData("123 {456")]
[InlineData("123 [45]6")]
[InlineData("123 (4)56")]
[InlineData("abc+56")]
[InlineData("abc.56")]
[InlineData("abc*56")]
[InlineData(@"hello12.1[)]*^$=!@23}")]
public void GetRouteData_HandlesUrlEncoding(string id)
{
HttpRoute route = new HttpRoute("{controller}/{id}");
Uri uri = new Uri("http://localhost/test/" + id + "/");
IHttpRouteData routeData = route.GetRouteData("", new HttpRequestMessage(HttpMethod.Get, uri));
Assert.Equal("test", routeData.Values["controller"]);
Assert.Equal(id, routeData.Values["id"]);
}
}
}