Skip to content

Commit b2d17f2

Browse files
Fix broken test from route constraint elimination
1 parent 3b5cfe0 commit b2d17f2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

test/Microsoft.AspNetCore.Mvc.Acceptance.Tests/Mvc/Basic/given a versioned Controller/when using a query string and split into two types.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ public async Task then_get_with_integer_id_should_return_200()
6262
}
6363

6464
[Fact]
65-
public async Task then_get_returns_400_with_invalid_id()
65+
public async Task then_get_returns_404_with_invalid_id()
6666
{
6767
// arrange
6868
var requestUrl = "api/values/abc?api-version=2.0";
6969

7070
// note: the classic routing mechanism cannot disambiguate 400 vs 405
7171
// because the route constraint {id:int} completely eliminates the
7272
// candidate; however, endpoint routing works as expected
73-
var statusCode = UsingEndpointRouting ? BadRequest : MethodNotAllowed;
73+
var statusCode = UsingEndpointRouting ? NotFound : MethodNotAllowed;
7474

7575
// act
7676
var response = await GetAsync( requestUrl );

test/Microsoft.AspNetCore.Mvc.Acceptance.Tests/Mvc/Basic/given a versioned Controller/when using a url segment.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ public async Task then_post_should_return_201( string version )
6666
}
6767

6868
[Fact]
69-
public async Task then_get_returns_400_with_invalid_id()
69+
public async Task then_get_returns_404_with_invalid_id()
7070
{
7171
// arrange
7272
var requestUrl = "api/v2/helloworld/abc";
7373

7474
// note: the classic routing mechanism cannot disambiguate 400 vs 405
7575
// because the route constraint {id:int} completely eliminates the
7676
// candidate; however, endpoint routing works as expected
77-
var statusCode = UsingEndpointRouting ? BadRequest : MethodNotAllowed;
77+
var statusCode = UsingEndpointRouting ? NotFound : MethodNotAllowed;
7878

7979
// act
8080
var response = await GetAsync( requestUrl );

0 commit comments

Comments
 (0)