Skip to content

Commit 8c2a7b4

Browse files
committed
Changed ID type from to for Flight
1 parent 605d2ce commit 8c2a7b4

File tree

5 files changed

+60
-84
lines changed

5 files changed

+60
-84
lines changed

test/OpenApiClientTests/LegacyClient/RequestTests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public async Task Getting_resource_collection_produces_expected_request()
3838
public async Task Getting_resource_produces_expected_request()
3939
{
4040
// Arrange
41-
const int flightId = 8712;
41+
const string flightId = "ZvuH1";
4242

4343
using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null);
4444
IOpenApiClient apiOpenApiClient = new OpenApiClient(wrapper.HttpClient);
@@ -212,7 +212,7 @@ public async Task Partial_patching_resource_produces_expected_request()
212212
public async Task Deleting_resource_produces_expected_request()
213213
{
214214
// Arrange
215-
const int flightId = 8712;
215+
const string flightId = "ZvuH1";
216216

217217
using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null);
218218
IOpenApiClient apiOpenApiClient = new OpenApiClient(wrapper.HttpClient);
@@ -230,7 +230,7 @@ public async Task Deleting_resource_produces_expected_request()
230230
public async Task Getting_secondary_resource_produces_expected_request()
231231
{
232232
// Arrange
233-
const int flightId = 8712;
233+
const string flightId = "ZvuH1";
234234

235235
using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null);
236236
IOpenApiClient apiOpenApiClient = new OpenApiClient(wrapper.HttpClient);
@@ -249,7 +249,7 @@ public async Task Getting_secondary_resource_produces_expected_request()
249249
public async Task Getting_secondary_resources_produces_expected_request()
250250
{
251251
// Arrange
252-
const int flightId = 8712;
252+
const string flightId = "ZvuH1";
253253

254254
using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null);
255255
IOpenApiClient apiOpenApiClient = new OpenApiClient(wrapper.HttpClient);
@@ -268,7 +268,7 @@ public async Task Getting_secondary_resources_produces_expected_request()
268268
public async Task Getting_ToOne_relationship_produces_expected_request()
269269
{
270270
// Arrange
271-
const int flightId = 8712;
271+
const string flightId = "ZvuH1";
272272

273273
using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null);
274274
IOpenApiClient apiOpenApiClient = new OpenApiClient(wrapper.HttpClient);
@@ -287,7 +287,7 @@ public async Task Getting_ToOne_relationship_produces_expected_request()
287287
public async Task Patching_ToOne_relationship_produces_expected_request()
288288
{
289289
// Arrange
290-
const int flightId = 8712;
290+
const string flightId = "ZvuH1";
291291

292292
using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null);
293293
IOpenApiClient apiOpenApiClient = new OpenApiClient(wrapper.HttpClient);
@@ -323,7 +323,7 @@ public async Task Patching_ToOne_relationship_produces_expected_request()
323323
public async Task Getting_ToMany_relationship_produces_expected_request()
324324
{
325325
// Arrange
326-
const int flightId = 8712;
326+
const string flightId = "ZvuH1";
327327

328328
using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null);
329329
IOpenApiClient apiOpenApiClient = new OpenApiClient(wrapper.HttpClient);
@@ -342,7 +342,7 @@ public async Task Getting_ToMany_relationship_produces_expected_request()
342342
public async Task Posting_ToMany_relationship_produces_expected_request()
343343
{
344344
// Arrange
345-
const int flightId = 8712;
345+
const string flightId = "ZvuH1";
346346

347347
using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null);
348348
IOpenApiClient apiOpenApiClient = new OpenApiClient(wrapper.HttpClient);
@@ -392,7 +392,7 @@ public async Task Posting_ToMany_relationship_produces_expected_request()
392392
public async Task Patching_ToMany_relationship_produces_expected_request()
393393
{
394394
// Arrange
395-
const int flightId = 8712;
395+
const string flightId = "ZvuH1";
396396

397397
using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null);
398398
IOpenApiClient apiOpenApiClient = new OpenApiClient(wrapper.HttpClient);
@@ -442,7 +442,7 @@ public async Task Patching_ToMany_relationship_produces_expected_request()
442442
public async Task Deleting_ToMany_relationship_produces_expected_request()
443443
{
444444
// Arrange
445-
const int flightId = 8712;
445+
const string flightId = "ZvuH1";
446446

447447
using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null);
448448
IOpenApiClient apiOpenApiClient = new OpenApiClient(wrapper.HttpClient);

test/OpenApiClientTests/LegacyClient/ResponseTests.cs

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public sealed class ResponseTests
2121
public async Task Getting_resource_collection_translates_response()
2222
{
2323
// Arrange
24-
const string flightId = "8712";
24+
const string flightId = "ZvuH1";
2525
const string flightDestination = "Destination of Flight";
2626
const string fightServiceOnBoard = "Movies";
2727
const string flightDepartsAt = "2014-11-25T00:00:00";
@@ -151,7 +151,7 @@ public async Task Getting_resource_collection_translates_response()
151151
public async Task Getting_resource_translates_response()
152152
{
153153
// Arrange
154-
const string flightId = "8712";
154+
const string flightId = "ZvuH1";
155155
const string departsAtInZuluTime = "2021-06-08T12:53:30.554Z";
156156
const string arrivesAtWithUtcOffset = "2019-02-20T11:56:33.0721266+01:00";
157157

@@ -176,7 +176,7 @@ public async Task Getting_resource_translates_response()
176176
IOpenApiClient openApiClient = new OpenApiClient(wrapper.HttpClient);
177177

178178
// Act
179-
FlightPrimaryResponseDocument document = await openApiClient.GetFlightAsync(Convert.ToInt32(flightId));
179+
FlightPrimaryResponseDocument document = await openApiClient.GetFlightAsync(flightId);
180180

181181
// Assert
182182
document.Jsonapi.Should().BeNull();
@@ -194,7 +194,7 @@ public async Task Getting_resource_translates_response()
194194
public async Task Getting_unknown_resource_translates_error_response()
195195
{
196196
// Arrange
197-
const string flightId = "8712";
197+
const string flightId = "ZvuH1";
198198

199199
const string responseBody = @"{
200200
""errors"": [
@@ -211,7 +211,7 @@ public async Task Getting_unknown_resource_translates_error_response()
211211
IOpenApiClient openApiClient = new OpenApiClient(wrapper.HttpClient);
212212

213213
// Act
214-
Func<Task<FlightPrimaryResponseDocument>> action = async () => await openApiClient.GetFlightAsync(Convert.ToInt32(flightId));
214+
Func<Task<FlightPrimaryResponseDocument>> action = async () => await openApiClient.GetFlightAsync(flightId);
215215

216216
// Assert
217217
ExceptionAssertions<ApiException> assertion = await action.Should().ThrowExactlyAsync<ApiException>();
@@ -225,7 +225,7 @@ public async Task Getting_unknown_resource_translates_error_response()
225225
public async Task Posting_resource_translates_response()
226226
{
227227
// Arrange
228-
const string flightId = "8712";
228+
const string flightId = "ZvuH1";
229229
const string flightAttendantId = "bBJHu";
230230

231231
const string responseBody = @"{
@@ -305,7 +305,7 @@ public async Task Posting_resource_translates_response()
305305
public async Task Patching_resource_with_side_effects_translates_response()
306306
{
307307
// Arrange
308-
const string flightId = "8712";
308+
const string flightId = "ZvuH1";
309309

310310
const string responseBody = @"{
311311
""links"": {
@@ -324,7 +324,7 @@ public async Task Patching_resource_with_side_effects_translates_response()
324324
IOpenApiClient openApiClient = new OpenApiClient(wrapper.HttpClient);
325325

326326
// Act
327-
FlightPrimaryResponseDocument document = await openApiClient.PatchFlightAsync(Convert.ToInt32(flightId), new FlightPatchRequestDocument
327+
FlightPrimaryResponseDocument document = await openApiClient.PatchFlightAsync(flightId, new FlightPatchRequestDocument
328328
{
329329
Data = new FlightDataInPatchRequest
330330
{
@@ -343,13 +343,13 @@ public async Task Patching_resource_with_side_effects_translates_response()
343343
public async Task Patching_resource_without_side_effects_translates_response()
344344
{
345345
// Arrange
346-
const string flightId = "8712";
346+
const string flightId = "ZvuH1";
347347
using var wrapper = FakeHttpClientWrapper.Create(HttpStatusCode.NoContent, null);
348348
IOpenApiClient openApiClient = new OpenApiClient(wrapper.HttpClient);
349349

350350
// Act
351-
FlightPrimaryResponseDocument document = await ApiResponse.TranslateAsync(async () => await openApiClient.PatchFlightAsync(
352-
Convert.ToInt32(flightId), new FlightPatchRequestDocument
351+
FlightPrimaryResponseDocument document = await ApiResponse.TranslateAsync(async () => await openApiClient.PatchFlightAsync(flightId,
352+
new FlightPatchRequestDocument
353353
{
354354
Data = new FlightDataInPatchRequest
355355
{
@@ -370,7 +370,7 @@ public async Task Deleting_resource_produces_empty_response()
370370
IOpenApiClient openApiClient = new OpenApiClient(wrapper.HttpClient);
371371

372372
// Act
373-
Func<Task> action = async () => await openApiClient.DeleteFlightAsync(8712);
373+
Func<Task> action = async () => await openApiClient.DeleteFlightAsync("ZvuH1");
374374

375375
// Assert
376376
await action.Should().NotThrowAsync();
@@ -380,7 +380,7 @@ public async Task Deleting_resource_produces_empty_response()
380380
public async Task Getting_secondary_resource_translates_response()
381381
{
382382
// Arrange
383-
const string flightId = "8712";
383+
const string flightId = "ZvuH1";
384384

385385
const string responseBody = @"{
386386
""links"": {
@@ -395,7 +395,7 @@ public async Task Getting_secondary_resource_translates_response()
395395
IOpenApiClient openApiClient = new OpenApiClient(wrapper.HttpClient);
396396

397397
// Act
398-
AirplaneSecondaryResponseDocument document = await openApiClient.GetFlightOperatingAirplaneAsync(Convert.ToInt32(flightId));
398+
AirplaneSecondaryResponseDocument document = await openApiClient.GetFlightOperatingAirplaneAsync(flightId);
399399

400400
// Assert
401401
document.Data.Should().BeNull();
@@ -405,7 +405,7 @@ public async Task Getting_secondary_resource_translates_response()
405405
public async Task Getting_secondary_resources_translates_response()
406406
{
407407
// Arrange
408-
const string flightId = "8712";
408+
const string flightId = "ZvuH1";
409409

410410
const string responseBody = @"{
411411
""links"": {
@@ -419,7 +419,7 @@ public async Task Getting_secondary_resources_translates_response()
419419
IOpenApiClient openApiClient = new OpenApiClient(wrapper.HttpClient);
420420

421421
// Act
422-
FlightAttendantCollectionResponseDocument document = await openApiClient.GetFlightCabinPersonnelAsync(Convert.ToInt32(flightId));
422+
FlightAttendantCollectionResponseDocument document = await openApiClient.GetFlightCabinPersonnelAsync(flightId);
423423

424424
// Assert
425425
document.Data.Should().BeEmpty();
@@ -429,7 +429,7 @@ public async Task Getting_secondary_resources_translates_response()
429429
public async Task Getting_ToOne_relationship_translates_response()
430430
{
431431
// Arrange
432-
const string flightId = "8712";
432+
const string flightId = "ZvuH1";
433433
const string operatingAirplaneId = "bBJHu";
434434

435435
const string responseBody = @"{
@@ -447,7 +447,7 @@ public async Task Getting_ToOne_relationship_translates_response()
447447
IOpenApiClient openApiClient = new OpenApiClient(wrapper.HttpClient);
448448

449449
// Act
450-
AirplaneIdentifierResponseDocument document = await openApiClient.GetFlightOperatingAirplaneRelationshipAsync(Convert.ToInt32(flightId));
450+
AirplaneIdentifierResponseDocument document = await openApiClient.GetFlightOperatingAirplaneRelationshipAsync(flightId);
451451

452452
// Assert
453453
document.Data.Should().NotBeNull();
@@ -463,7 +463,7 @@ public async Task Patching_ToOne_relationship_translates_response()
463463
IOpenApiClient openApiClient = new OpenApiClient(wrapper.HttpClient);
464464

465465
// Act
466-
await openApiClient.PatchFlightOperatingAirplaneRelationshipAsync(8712, new ToOneAirplaneRequestData
466+
await openApiClient.PatchFlightOperatingAirplaneRelationshipAsync("ZvuH1", new ToOneAirplaneRequestData
467467
{
468468
Data = new AirplaneIdentifier
469469
{
@@ -477,7 +477,7 @@ public async Task Patching_ToOne_relationship_translates_response()
477477
public async Task Getting_ToMany_relationship_translates_response()
478478
{
479479
// Arrange
480-
const string flightId = "8712";
480+
const string flightId = "ZvuH1";
481481
const string flightAttendantId1 = "bBJHu";
482482
const string flightAttendantId2 = "ZvuHNInmX1";
483483

@@ -501,8 +501,7 @@ public async Task Getting_ToMany_relationship_translates_response()
501501
IOpenApiClient openApiClient = new OpenApiClient(wrapper.HttpClient);
502502

503503
// Act
504-
FlightAttendantIdentifierCollectionResponseDocument document =
505-
await openApiClient.GetFlightCabinPersonnelRelationshipAsync(Convert.ToInt32(flightId));
504+
FlightAttendantIdentifierCollectionResponseDocument document = await openApiClient.GetFlightCabinPersonnelRelationshipAsync(flightId);
506505

507506
// Assert
508507
document.Data.Should().HaveCount(2);
@@ -520,7 +519,7 @@ public async Task Posting_ToMany_relationship_produces_empty_response()
520519
IOpenApiClient openApiClient = new OpenApiClient(wrapper.HttpClient);
521520

522521
// Act
523-
Func<Task> action = async () => await openApiClient.PostFlightCabinPersonnelRelationshipAsync(8712, new ToManyFlightAttendantRequestData
522+
Func<Task> action = async () => await openApiClient.PostFlightCabinPersonnelRelationshipAsync("ZvuH1", new ToManyFlightAttendantRequestData
524523
{
525524
Data = new List<FlightAttendantIdentifier>
526525
{
@@ -549,7 +548,7 @@ public async Task Patching_ToMany_relationship_produces_empty_response()
549548
IOpenApiClient openApiClient = new OpenApiClient(wrapper.HttpClient);
550549

551550
// Act
552-
Func<Task> action = async () => await openApiClient.PatchFlightCabinPersonnelRelationshipAsync(8712, new ToManyFlightAttendantRequestData
551+
Func<Task> action = async () => await openApiClient.PatchFlightCabinPersonnelRelationshipAsync("ZvuH1", new ToManyFlightAttendantRequestData
553552
{
554553
Data = new List<FlightAttendantIdentifier>
555554
{
@@ -578,7 +577,7 @@ public async Task Deleting_ToMany_relationship_produces_empty_response()
578577
IOpenApiClient openApiClient = new OpenApiClient(wrapper.HttpClient);
579578

580579
// Act
581-
Func<Task> action = async () => await openApiClient.DeleteFlightCabinPersonnelRelationshipAsync(8712, new ToManyFlightAttendantRequestData
580+
Func<Task> action = async () => await openApiClient.DeleteFlightCabinPersonnelRelationshipAsync("ZvuH1", new ToManyFlightAttendantRequestData
582581
{
583582
Data = new List<FlightAttendantIdentifier>
584583
{

test/OpenApiTests/LegacyOpenApiIntegration/Flight.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace OpenApiTests.LegacyOpenApiIntegration
1010
{
1111
[UsedImplicitly(ImplicitUseTargetFlags.Members)]
12-
public sealed class Flight : Identifiable
12+
public sealed class Flight : Identifiable<string>
1313
{
1414
[Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowChange)]
1515
[Required]

test/OpenApiTests/LegacyOpenApiIntegration/FlightsController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
namespace OpenApiTests.LegacyOpenApiIntegration
77
{
8-
public sealed class FlightsController : JsonApiController<Flight>
8+
public sealed class FlightsController : JsonApiController<Flight, string>
99
{
10-
public FlightsController(IJsonApiOptions options, ILoggerFactory loggerFactory, IResourceService<Flight> resourceService)
10+
public FlightsController(IJsonApiOptions options, ILoggerFactory loggerFactory, IResourceService<Flight, string> resourceService)
1111
: base(options, loggerFactory, resourceService)
1212
{
1313
}

0 commit comments

Comments
 (0)