|
|
@@ -26,6 +26,28 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
|
|
|
|
|
|
public HttpClient Client { get; }
|
|
|
|
|
|
+ [Theory]
|
|
|
+ [InlineData("http://localhost/Login/Index", "Login", "Index", "http://localhost/Login")]
|
|
|
+ [InlineData("http://localhost/Login/Sso", "Login", "Sso", "http://localhost/Login/Sso")]
|
|
|
+ [InlineData("http://localhost/Contact/Index", "Contact", "Index", "http://localhost/Contact")]
|
|
|
+ [InlineData("http://localhost/Contact/Sso", "Contact", "Sso", "http://localhost/Contact/Sso")]
|
|
|
+ public async Task ConventionalRoutedAction_RouteUrl_AmbientValues(string requestUrl, string controller, string action, string expectedUrl)
|
|
|
+ {
|
|
|
+ // Arrange & Act
|
|
|
+ var response = await Client.GetAsync(requestUrl);
|
|
|
+
|
|
|
+ // Assert
|
|
|
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
|
+
|
|
|
+ var body = await response.Content.ReadAsStringAsync();
|
|
|
+ var result = JsonConvert.DeserializeObject<RoutingResult>(body);
|
|
|
+
|
|
|
+ Assert.Equal(controller, result.Controller);
|
|
|
+ Assert.Equal(action, result.Action);
|
|
|
+
|
|
|
+ Assert.Equal(expectedUrl, Assert.Single(result.ExpectedUrls));
|
|
|
+ }
|
|
|
+
|
|
|
[Fact]
|
|
|
public async Task ConventionalRoutedAction_RouteContainsPage_RouteNotMatched()
|
|
|
{
|