@@ -19,6 +19,7 @@ public sealed class AbsoluteLinksWithNamespaceTests
19
19
: IClassFixture < IntegrationTestContext < AbsoluteLinksInApiNamespaceStartup < LinksDbContext > , LinksDbContext > >
20
20
{
21
21
private const string HostPrefix = "http://localhost" ;
22
+ private const string PathPrefix = "/api" ;
22
23
23
24
private readonly IntegrationTestContext < AbsoluteLinksInApiNamespaceStartup < LinksDbContext > , LinksDbContext > _testContext ;
24
25
private readonly LinksFakers _fakers = new ( ) ;
@@ -51,7 +52,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
51
52
await dbContext . SaveChangesAsync ( ) ;
52
53
} ) ;
53
54
54
- string route = $ "/api /photoAlbums/{ album . StringId } ";
55
+ string route = $ "{ PathPrefix } /photoAlbums/{ album . StringId } ";
55
56
56
57
// Act
57
58
( HttpResponseMessage httpResponse , Document responseDocument ) = await _testContext . ExecuteGetAsync < Document > ( route ) ;
@@ -86,7 +87,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
86
87
await dbContext . SaveChangesAsync ( ) ;
87
88
} ) ;
88
89
89
- const string route = "/api /photoAlbums?include=photos";
90
+ string route = $ " { PathPrefix } /photoAlbums?include=photos";
90
91
91
92
// Act
92
93
( HttpResponseMessage httpResponse , Document responseDocument ) = await _testContext . ExecuteGetAsync < Document > ( route ) ;
@@ -101,14 +102,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
101
102
responseDocument . Links . Prev . Should ( ) . BeNull ( ) ;
102
103
responseDocument . Links . Next . Should ( ) . BeNull ( ) ;
103
104
104
- string albumLink = $ "{ HostPrefix } /api /photoAlbums/{ album . StringId } ";
105
+ string albumLink = $ "{ HostPrefix } { PathPrefix } /photoAlbums/{ album . StringId } ";
105
106
106
107
responseDocument . Data . ManyValue . ShouldHaveCount ( 1 ) ;
107
108
responseDocument . Data . ManyValue [ 0 ] . Links . Self . Should ( ) . Be ( albumLink ) ;
108
109
responseDocument . Data . ManyValue [ 0 ] . Relationships [ "photos" ] . Links . Self . Should ( ) . Be ( $ "{ albumLink } /relationships/photos") ;
109
110
responseDocument . Data . ManyValue [ 0 ] . Relationships [ "photos" ] . Links . Related . Should ( ) . Be ( $ "{ albumLink } /photos") ;
110
111
111
- string photoLink = $ "{ HostPrefix } /api /photos/{ album . Photos . ElementAt ( 0 ) . StringId } ";
112
+ string photoLink = $ "{ HostPrefix } { PathPrefix } /photos/{ album . Photos . ElementAt ( 0 ) . StringId } ";
112
113
113
114
responseDocument . Included . ShouldHaveCount ( 1 ) ;
114
115
responseDocument . Included [ 0 ] . Links . Self . Should ( ) . Be ( photoLink ) ;
@@ -129,7 +130,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
129
130
await dbContext . SaveChangesAsync ( ) ;
130
131
} ) ;
131
132
132
- string route = $ "/api /photos/{ photo . StringId } /album";
133
+ string route = $ "{ PathPrefix } /photos/{ photo . StringId } /album";
133
134
134
135
// Act
135
136
( HttpResponseMessage httpResponse , Document responseDocument ) = await _testContext . ExecuteGetAsync < Document > ( route ) ;
@@ -144,7 +145,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
144
145
responseDocument . Links . Prev . Should ( ) . BeNull ( ) ;
145
146
responseDocument . Links . Next . Should ( ) . BeNull ( ) ;
146
147
147
- string albumLink = $ "{ HostPrefix } /api /photoAlbums/{ photo . Album . StringId } ";
148
+ string albumLink = $ "{ HostPrefix } { PathPrefix } /photoAlbums/{ photo . Album . StringId } ";
148
149
149
150
responseDocument . Data . SingleValue . ShouldNotBeNull ( ) ;
150
151
responseDocument . Data . SingleValue . Links . Self . Should ( ) . Be ( albumLink ) ;
@@ -165,7 +166,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
165
166
await dbContext . SaveChangesAsync ( ) ;
166
167
} ) ;
167
168
168
- string route = $ "/api /photoAlbums/{ album . StringId } /photos";
169
+ string route = $ "{ PathPrefix } /photoAlbums/{ album . StringId } /photos";
169
170
170
171
// Act
171
172
( HttpResponseMessage httpResponse , Document responseDocument ) = await _testContext . ExecuteGetAsync < Document > ( route ) ;
@@ -180,7 +181,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
180
181
responseDocument . Links . Prev . Should ( ) . BeNull ( ) ;
181
182
responseDocument . Links . Next . Should ( ) . BeNull ( ) ;
182
183
183
- string photoLink = $ "{ HostPrefix } /api /photos/{ album . Photos . ElementAt ( 0 ) . StringId } ";
184
+ string photoLink = $ "{ HostPrefix } { PathPrefix } /photos/{ album . Photos . ElementAt ( 0 ) . StringId } ";
184
185
185
186
responseDocument . Data . ManyValue . ShouldHaveCount ( 1 ) ;
186
187
responseDocument . Data . ManyValue [ 0 ] . Links . Self . Should ( ) . Be ( photoLink ) ;
@@ -201,7 +202,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
201
202
await dbContext . SaveChangesAsync ( ) ;
202
203
} ) ;
203
204
204
- string route = $ "/api /photos/{ photo . StringId } /relationships/album";
205
+ string route = $ "{ PathPrefix } /photos/{ photo . StringId } /relationships/album";
205
206
206
207
// Act
207
208
( HttpResponseMessage httpResponse , Document responseDocument ) = await _testContext . ExecuteGetAsync < Document > ( route ) ;
@@ -210,7 +211,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
210
211
httpResponse . Should ( ) . HaveStatusCode ( HttpStatusCode . OK ) ;
211
212
212
213
responseDocument . Links . Self . Should ( ) . Be ( $ "{ HostPrefix } { route } ") ;
213
- responseDocument . Links . Related . Should ( ) . Be ( $ "{ HostPrefix } /api /photos/{ photo . StringId } /album") ;
214
+ responseDocument . Links . Related . Should ( ) . Be ( $ "{ HostPrefix } { PathPrefix } /photos/{ photo . StringId } /album") ;
214
215
responseDocument . Links . First . Should ( ) . BeNull ( ) ;
215
216
responseDocument . Links . Last . Should ( ) . BeNull ( ) ;
216
217
responseDocument . Links . Prev . Should ( ) . BeNull ( ) ;
@@ -234,7 +235,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
234
235
await dbContext . SaveChangesAsync ( ) ;
235
236
} ) ;
236
237
237
- string route = $ "/api /photoAlbums/{ album . StringId } /relationships/photos";
238
+ string route = $ "{ PathPrefix } /photoAlbums/{ album . StringId } /relationships/photos";
238
239
239
240
// Act
240
241
( HttpResponseMessage httpResponse , Document responseDocument ) = await _testContext . ExecuteGetAsync < Document > ( route ) ;
@@ -243,7 +244,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
243
244
httpResponse . Should ( ) . HaveStatusCode ( HttpStatusCode . OK ) ;
244
245
245
246
responseDocument . Links . Self . Should ( ) . Be ( $ "{ HostPrefix } { route } ") ;
246
- responseDocument . Links . Related . Should ( ) . Be ( $ "{ HostPrefix } /api /photoAlbums/{ album . StringId } /photos") ;
247
+ responseDocument . Links . Related . Should ( ) . Be ( $ "{ HostPrefix } { PathPrefix } /photoAlbums/{ album . StringId } /photos") ;
247
248
responseDocument . Links . First . Should ( ) . Be ( $ "{ HostPrefix } { route } ") ;
248
249
responseDocument . Links . Last . Should ( ) . BeNull ( ) ;
249
250
responseDocument . Links . Prev . Should ( ) . BeNull ( ) ;
@@ -288,7 +289,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
288
289
}
289
290
} ;
290
291
291
- const string route = "/api /photoAlbums?include=photos";
292
+ string route = $ " { PathPrefix } /photoAlbums?include=photos";
292
293
293
294
// Act
294
295
( HttpResponseMessage httpResponse , Document responseDocument ) = await _testContext . ExecutePostAsync < Document > ( route , requestBody ) ;
@@ -303,13 +304,13 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
303
304
responseDocument . Links . Prev . Should ( ) . BeNull ( ) ;
304
305
responseDocument . Links . Next . Should ( ) . BeNull ( ) ;
305
306
306
- string albumLink = $ "{ HostPrefix } /api /photoAlbums/{ responseDocument . Data . SingleValue . Id } ";
307
+ string albumLink = $ "{ HostPrefix } { PathPrefix } /photoAlbums/{ responseDocument . Data . SingleValue . Id } ";
307
308
308
309
responseDocument . Data . SingleValue . Links . Self . Should ( ) . Be ( albumLink ) ;
309
310
responseDocument . Data . SingleValue . Relationships [ "photos" ] . Links . Self . Should ( ) . Be ( $ "{ albumLink } /relationships/photos") ;
310
311
responseDocument . Data . SingleValue . Relationships [ "photos" ] . Links . Related . Should ( ) . Be ( $ "{ albumLink } /photos") ;
311
312
312
- string photoLink = $ "{ HostPrefix } /api /photos/{ existingPhoto . StringId } ";
313
+ string photoLink = $ "{ HostPrefix } { PathPrefix } /photos/{ existingPhoto . StringId } ";
313
314
314
315
responseDocument . Included . ShouldHaveCount ( 1 ) ;
315
316
responseDocument . Included [ 0 ] . Links . Self . Should ( ) . Be ( photoLink ) ;
@@ -350,7 +351,7 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
350
351
}
351
352
} ;
352
353
353
- string route = $ "/api /photos/{ existingPhoto . StringId } ?include=album";
354
+ string route = $ "{ PathPrefix } /photos/{ existingPhoto . StringId } ?include=album";
354
355
355
356
// Act
356
357
( HttpResponseMessage httpResponse , Document responseDocument ) = await _testContext . ExecutePatchAsync < Document > ( route , requestBody ) ;
@@ -365,14 +366,14 @@ await _testContext.RunOnDatabaseAsync(async dbContext =>
365
366
responseDocument . Links . Prev . Should ( ) . BeNull ( ) ;
366
367
responseDocument . Links . Next . Should ( ) . BeNull ( ) ;
367
368
368
- string photoLink = $ "{ HostPrefix } /api /photos/{ existingPhoto . StringId } ";
369
+ string photoLink = $ "{ HostPrefix } { PathPrefix } /photos/{ existingPhoto . StringId } ";
369
370
370
371
responseDocument . Data . SingleValue . ShouldNotBeNull ( ) ;
371
372
responseDocument . Data . SingleValue . Links . Self . Should ( ) . Be ( photoLink ) ;
372
373
responseDocument . Data . SingleValue . Relationships [ "album" ] . Links . Self . Should ( ) . Be ( $ "{ photoLink } /relationships/album") ;
373
374
responseDocument . Data . SingleValue . Relationships [ "album" ] . Links . Related . Should ( ) . Be ( $ "{ photoLink } /album") ;
374
375
375
- string albumLink = $ "{ HostPrefix } /api /photoAlbums/{ existingAlbum . StringId } ";
376
+ string albumLink = $ "{ HostPrefix } { PathPrefix } /photoAlbums/{ existingAlbum . StringId } ";
376
377
377
378
responseDocument . Included . ShouldHaveCount ( 1 ) ;
378
379
responseDocument . Included [ 0 ] . Links . Self . Should ( ) . Be ( albumLink ) ;
0 commit comments