File tree 1 file changed +28
-1
lines changed
test/JsonApiDotNetCoreExampleTests/Acceptance/Spec
1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change 1
- using System . Net ;
1
+ using System . Linq ;
2
+ using System . Net ;
2
3
using System . Net . Http ;
3
4
using System . Threading . Tasks ;
4
5
using Bogus ;
@@ -96,5 +97,31 @@ public async Task Included_Records_Contain_Relationship_Links()
96
97
Assert . Equal ( $ "http://localhost/api/v1/people/{ person . Id } /relationships/todo-items", deserializedBody . Included [ 0 ] . Relationships [ "todo-items" ] . Links . Self ) ;
97
98
context . Dispose ( ) ;
98
99
}
100
+
101
+ [ Fact ]
102
+ public async Task GetResources_NoDefaultPageSize_ReturnsResources ( )
103
+ {
104
+ // Arrange
105
+ var context = _fixture . GetService < AppDbContext > ( ) ;
106
+ var todoItems = _todoItemFaker . Generate ( 20 ) . ToList ( ) ;
107
+ context . TodoItems . AddRange ( todoItems ) ;
108
+ await context . SaveChangesAsync ( ) ;
109
+
110
+ var builder = new WebHostBuilder ( )
111
+ . UseStartup < NoDefaultPageSizeStartup > ( ) ;
112
+ var httpMethod = new HttpMethod ( "GET" ) ;
113
+ var route = $ "/api/v1/todo-items";
114
+ var server = new TestServer ( builder ) ;
115
+ var client = server . CreateClient ( ) ;
116
+ var request = new HttpRequestMessage ( httpMethod , route ) ;
117
+
118
+ // Act
119
+ var response = await client . SendAsync ( request ) ;
120
+ var body = await response . Content . ReadAsStringAsync ( ) ;
121
+ var result = _fixture . GetDeserializer ( ) . DeserializeList < TodoItem > ( body ) ;
122
+
123
+ // Assert
124
+ Assert . True ( result . Data . Count >= 20 ) ;
125
+ }
99
126
}
100
127
}
You can’t perform that action at this time.
0 commit comments