File tree 2 files changed +49
-0
lines changed
src/JsonApiDotNetCoreExample/Controllers
test/JsonApiDotNetCoreExampleTests/Acceptance/Extensibility
2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ using Microsoft . AspNetCore . Mvc ;
2
+
3
+ namespace JsonApiDotNetCoreExample . Controllers
4
+ {
5
+ [ Route ( "[controller]" ) ]
6
+ public class TestValuesController : Controller
7
+ {
8
+ [ HttpGet ]
9
+ public IActionResult Get ( )
10
+ {
11
+ var result = new string [ ] { "value" } ;
12
+ return Ok ( result ) ;
13
+ }
14
+ }
15
+ }
Original file line number Diff line number Diff line change
1
+ using System . Net ;
2
+ using System . Net . Http ;
3
+ using System . Threading . Tasks ;
4
+ using Microsoft . AspNetCore . Hosting ;
5
+ using Microsoft . AspNetCore . TestHost ;
6
+ using Xunit ;
7
+ using JsonApiDotNetCoreExample ;
8
+
9
+ namespace JsonApiDotNetCoreExampleTests . Acceptance . Extensibility
10
+ {
11
+ [ Collection ( "WebHostCollection" ) ]
12
+ public class CustomControllerTests
13
+ {
14
+ [ Fact ]
15
+ public async Task NonJsonApiControllers_DoNotUse_Dasherized_Routes ( )
16
+ {
17
+ // arrange
18
+ var builder = new WebHostBuilder ( )
19
+ . UseStartup < Startup > ( ) ;
20
+ var httpMethod = new HttpMethod ( "GET" ) ;
21
+ var route = $ "testValues";
22
+
23
+ var server = new TestServer ( builder ) ;
24
+ var client = server . CreateClient ( ) ;
25
+ var request = new HttpRequestMessage ( httpMethod , route ) ;
26
+
27
+ // act
28
+ var response = await client . SendAsync ( request ) ;
29
+
30
+ // assert
31
+ Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
32
+ }
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments