@@ -170,7 +170,7 @@ public class FlightWebRequestUnitTest : IClassFixture<WebApplicationFactory<Prog
170170 IATA = iata ,
171171 Name = iata ,
172172 SortDestinationID = DefaultSortDestinationID ,
173- } ) ;
173+ } , TestContext . Current . CancellationToken ) ;
174174
175175 return operationResult . DataObject as Airline ;
176176 }
@@ -271,7 +271,7 @@ public async Task VerifyAddDuplicateFlightFailure()
271271 Name = "Add Duplicate Flight Test 1" ,
272272 Destination = DefaultAirportCode ,
273273 SortDestinationID = DefaultSortDestinationID ,
274- } ) ;
274+ } , TestContext . Current . CancellationToken ) ;
275275 Assert . True ( operationResult . IsSuccessStatusCode , "Failed to create the first flight." ) ;
276276
277277 operationResult = await dataLayer . CreateAsync ( new Flight ( )
@@ -283,7 +283,7 @@ public async Task VerifyAddDuplicateFlightFailure()
283283 Name = "Add Duplicate Flight Test New" ,
284284 Destination = DefaultAirportCode ,
285285 SortDestinationID = DefaultSortDestinationID ,
286- } ) ;
286+ } , TestContext . Current . CancellationToken ) ;
287287
288288 //The operation must have failed.
289289 Assert . False ( operationResult . IsSuccessStatusCode , "The operation should have failed." ) ;
@@ -353,7 +353,7 @@ public async Task VerifyAddFlight(string gateName, string airlineIATA, string fl
353353 Destination = destination ,
354354 SortDestinationID = sortDestination . Integer64ID ,
355355 } ;
356- OperationResult operationResult = await dataLayer . CreateAsync ( flight ) ;
356+ OperationResult operationResult = await dataLayer . CreateAsync ( flight , TestContext . Current . CancellationToken ) ;
357357
358358 Assert . True ( operationResult . IsSuccessStatusCode , "The operation should have been successful." ) ; //The operation must have been successful.
359359 Assert . IsType < Flight > ( operationResult . DataObject ) ; //A flight must have been returned.
@@ -379,7 +379,7 @@ public async Task VerifyAddFlightAirlineNotFoundFailure()
379379 Name = "Add Flight Airline Not Found Test" ,
380380 Destination = DefaultAirportCode ,
381381 SortDestinationID = DefaultSortDestinationID ,
382- } ) ;
382+ } , TestContext . Current . CancellationToken ) ;
383383
384384 //The operation must have failed.
385385 Assert . False ( operationResult . IsSuccessStatusCode , "The operation should have failed." ) ;
@@ -415,7 +415,7 @@ public async Task VerifyAddFlightBadDestinationFailure()
415415 Name = "Add Bad Destination Test" ,
416416 Destination = BadFormatttedDestination ,
417417 SortDestinationID = DefaultSortDestinationID ,
418- } ) ;
418+ } , TestContext . Current . CancellationToken ) ;
419419
420420 //The operation must have failed.
421421 Assert . False ( operationResult . IsSuccessStatusCode , "The operation should have failed." ) ;
@@ -451,7 +451,7 @@ public async Task VerifyAddFlightBadFlightNumberFailure()
451451 Name = "Add Bad Flight Number Test" ,
452452 Destination = DefaultAirportCode ,
453453 SortDestinationID = DefaultSortDestinationID ,
454- } ) ;
454+ } , TestContext . Current . CancellationToken ) ;
455455
456456 //The operation must have failed.
457457 Assert . False ( operationResult . IsSuccessStatusCode , "The operation should have failed." ) ;
@@ -488,7 +488,7 @@ public async Task VerifyAddFlightCodeShareAirlineNotFoundFailure()
488488 Name = "Add Flight CodeShare Airline Not Found Test" ,
489489 Destination = DefaultAirportCode ,
490490 SortDestinationID = DefaultSortDestinationID ,
491- } ) ;
491+ } , TestContext . Current . CancellationToken ) ;
492492
493493 //The operation must have failed.
494494 Assert . False ( operationResult . IsSuccessStatusCode , "The operation should have failed." ) ;
@@ -524,7 +524,7 @@ public async Task VerifyAddFlightGateNotFoundFailure()
524524 Name = "Add Flight Gate Not Found Test" ,
525525 Destination = DefaultAirportCode ,
526526 SortDestinationID = DefaultSortDestinationID ,
527- } ) ;
527+ } , TestContext . Current . CancellationToken ) ;
528528
529529 //The operation must have failed.
530530 Assert . False ( operationResult . IsSuccessStatusCode , "The operation should have failed." ) ;
@@ -560,7 +560,7 @@ public async Task VerifyAddFlightSortDestinationNotFoundFailure()
560560 Name = "Add Flight Sort Destination Not Found Test" ,
561561 Destination = DefaultAirportCode ,
562562 SortDestinationID = BadSortDestinationID ,
563- } ) ;
563+ } , TestContext . Current . CancellationToken ) ;
564564
565565 //The operation must have failed.
566566 Assert . False ( operationResult . IsSuccessStatusCode , "The operation should have failed." ) ;
@@ -587,7 +587,7 @@ public async Task VerifyCountFlights()
587587 HttpClient httpClient = _factory . CreateClient ( ) ;
588588 FlightDataLayer dataLayer = new ( httpClient ) ;
589589
590- long count = await dataLayer . CountAsync ( ) ;
590+ long count = await dataLayer . CountAsync ( TestContext . Current . CancellationToken ) ;
591591 Assert . True ( count > 0 ) ;
592592 }
593593
@@ -617,13 +617,13 @@ public async Task VerifyDeleteAirlineCascade()
617617 Name = "Delete Airline Cascade Test" ,
618618 Destination = DefaultAirportCode ,
619619 SortDestinationID = DefaultSortDestinationID ,
620- } ) ;
620+ } , TestContext . Current . CancellationToken ) ;
621621 Assert . True ( operationResult . IsSuccessStatusCode , "Failed to create the flight." ) ;
622622
623- operationResult = await new Airlines . AirlineDataLayer ( httpClient ) . DeleteAsync ( airline ) ;
623+ operationResult = await new Airlines . AirlineDataLayer ( httpClient ) . DeleteAsync ( airline , TestContext . Current . CancellationToken ) ;
624624 Assert . True ( operationResult . IsSuccessStatusCode , "Failed to delete the airline." ) ;
625625
626- List < Flight > ? flights = await dataLayer . GetAllAsync ( ) ;
626+ List < Flight > ? flights = await dataLayer . GetAllAsync ( TestContext . Current . CancellationToken ) ;
627627
628628 if ( flights is null )
629629 {
@@ -653,11 +653,11 @@ public async Task VerifyDeleteFlight()
653653 Name = "Delete Flight Test" ,
654654 Destination = DefaultAirportCode ,
655655 SortDestinationID = DefaultSortDestinationID ,
656- } ) ;
656+ } , TestContext . Current . CancellationToken ) ;
657657
658658 if ( operationResult . IsSuccessStatusCode && operationResult . DataObject is Flight flight )
659659 {
660- operationResult = await dataLayer . DeleteAsync ( flight ) ;
660+ operationResult = await dataLayer . DeleteAsync ( flight , TestContext . Current . CancellationToken ) ;
661661 Assert . True ( operationResult . IsSuccessStatusCode ) ;
662662 }
663663 else
@@ -675,7 +675,7 @@ public async Task VerifyGetAllFlights()
675675 {
676676 HttpClient httpClient = _factory . CreateClient ( ) ;
677677 FlightDataLayer dataLayer = new ( httpClient ) ;
678- List < Flight > ? flights = await dataLayer . GetAllAsync ( ) ;
678+ List < Flight > ? flights = await dataLayer . GetAllAsync ( TestContext . Current . CancellationToken ) ;
679679
680680 //Flights must have been returned.
681681 Assert . NotNull ( flights ) ;
@@ -691,7 +691,7 @@ public async Task VerifyGetAllListViewFlights()
691691 {
692692 HttpClient httpClient = _factory . CreateClient ( ) ;
693693 FlightDataLayer dataLayer = new ( httpClient ) ;
694- List < ListView > ? flights = await dataLayer . GetAllListViewAsync ( ) ;
694+ List < ListView > ? flights = await dataLayer . GetAllListViewAsync ( TestContext . Current . CancellationToken ) ;
695695
696696 //List view flights must have been returned.
697697 Assert . NotNull ( flights ) ;
@@ -708,7 +708,7 @@ public async Task VerifyGetSingleFlight()
708708 HttpClient httpClient = _factory . CreateClient ( ) ;
709709 FlightDataLayer dataLayer = new ( httpClient ) ;
710710
711- Flight ? flight = await dataLayer . GetSingleAsync ( ) ;
711+ Flight ? flight = await dataLayer . GetSingleAsync ( TestContext . Current . CancellationToken ) ;
712712 Assert . NotNull ( flight ) ;
713713 }
714714
@@ -722,7 +722,7 @@ public async Task VerifyGetSingleFlightWithId()
722722 HttpClient httpClient = _factory . CreateClient ( ) ;
723723 FlightDataLayer dataLayer = new ( httpClient ) ;
724724
725- Flight ? flight = await dataLayer . GetSingleAsync ( 1 ) ;
725+ Flight ? flight = await dataLayer . GetSingleAsync ( 1 , TestContext . Current . CancellationToken ) ;
726726 Assert . NotNull ( flight ) ;
727727 }
728728
@@ -745,7 +745,7 @@ public async Task VerifyUpdateDuplicateFlightFailure()
745745 Name = "Update Duplicate Flight Test 1" ,
746746 Destination = DefaultAirportCode ,
747747 SortDestinationID = DefaultSortDestinationID ,
748- } ) ;
748+ } , TestContext . Current . CancellationToken ) ;
749749 Assert . True ( operationResult . IsSuccessStatusCode , "Failed to create the first flight." ) ;
750750
751751 operationResult = await dataLayer . CreateAsync ( new Flight ( )
@@ -757,7 +757,7 @@ public async Task VerifyUpdateDuplicateFlightFailure()
757757 Name = "Update Duplicate Flight Test New" ,
758758 Destination = DefaultAirportCode ,
759759 SortDestinationID = DefaultSortDestinationID ,
760- } ) ;
760+ } , TestContext . Current . CancellationToken ) ;
761761
762762 if ( operationResult . IsSuccessStatusCode && operationResult . DataObject is Flight secondFlight )
763763 {
@@ -771,7 +771,7 @@ public async Task VerifyUpdateDuplicateFlightFailure()
771771 Name = "Update Duplicate Flight Test New" ,
772772 Destination = DefaultAirportCode ,
773773 SortDestinationID = DefaultSortDestinationID ,
774- } ) ;
774+ } , TestContext . Current . CancellationToken ) ;
775775
776776 //The operation must have failed.
777777 Assert . False ( operationResult . IsSuccessStatusCode , "The operation should have failed." ) ;
@@ -842,7 +842,7 @@ public async Task VerifyUpdateFlight(string gateName, string airlineIATA, string
842842 Name = $ "{ airline . IATA } { flightNumber } ",
843843 Destination = DefaultAirportCode ,
844844 SortDestinationID = DefaultSortDestinationID ,
845- } ) ;
845+ } , TestContext . Current . CancellationToken ) ;
846846
847847 if ( operationResult . IsSuccessStatusCode && operationResult . DataObject is Flight createdFlight )
848848 {
@@ -860,7 +860,7 @@ public async Task VerifyUpdateFlight(string gateName, string airlineIATA, string
860860 Destination = destination ,
861861 SortDestinationID = sortDestination . Integer64ID ,
862862 } ;
863- operationResult = await dataLayer . UpdateAsync ( flight ) ;
863+ operationResult = await dataLayer . UpdateAsync ( flight , TestContext . Current . CancellationToken ) ;
864864
865865 Assert . True ( operationResult . IsSuccessStatusCode , "The operation should have been successful." ) ; //The operation must have been successful.
866866 Assert . IsType < Flight > ( operationResult . DataObject ) ; //A flight must have been returned.
@@ -891,7 +891,7 @@ public async Task VerifyUpdateFlightAirlineNotFoundFailure()
891891 Name = "Update Flight Airline Not Found Test" ,
892892 Destination = DefaultAirportCode ,
893893 SortDestinationID = DefaultSortDestinationID ,
894- } ) ;
894+ } , TestContext . Current . CancellationToken ) ;
895895
896896 if ( operationResult . IsSuccessStatusCode && operationResult . DataObject is Flight createdFlight )
897897 {
@@ -905,7 +905,7 @@ public async Task VerifyUpdateFlightAirlineNotFoundFailure()
905905 Name = "Update Flight Airline Not Found Test" ,
906906 Destination = DefaultAirportCode ,
907907 SortDestinationID = DefaultSortDestinationID ,
908- } ) ;
908+ } , TestContext . Current . CancellationToken ) ;
909909
910910 //The operation must have failed.
911911 Assert . False ( operationResult . IsSuccessStatusCode , "The operation should have failed." ) ;
@@ -946,12 +946,12 @@ public async Task VerifyUpdateFlightBadDestinationFailure()
946946 Name = "Update Bad Destination Test" ,
947947 Destination = DefaultAirportCode ,
948948 SortDestinationID = DefaultSortDestinationID ,
949- } ) ;
949+ } , TestContext . Current . CancellationToken ) ;
950950
951951 if ( operationResult . IsSuccessStatusCode && operationResult . DataObject is Flight flight )
952952 {
953953 flight . Destination = BadFormatttedDestination ;
954- operationResult = await dataLayer . UpdateAsync ( flight ) ;
954+ operationResult = await dataLayer . UpdateAsync ( flight , TestContext . Current . CancellationToken ) ;
955955
956956 //The operation must have failed.
957957 Assert . False ( operationResult . IsSuccessStatusCode , "The operation should have failed." ) ;
@@ -992,12 +992,12 @@ public async Task VerifyUpdateFlightBadFlightNumberFailure()
992992 Name = "Update Bad Flight Number Test" ,
993993 Destination = DefaultAirportCode ,
994994 SortDestinationID = DefaultSortDestinationID ,
995- } ) ;
995+ } , TestContext . Current . CancellationToken ) ;
996996
997997 if ( operationResult . IsSuccessStatusCode && operationResult . DataObject is Flight flight )
998998 {
999999 flight . FlightNumber = BadFormatttedFlightNumber ;
1000- operationResult = await dataLayer . UpdateAsync ( flight ) ;
1000+ operationResult = await dataLayer . UpdateAsync ( flight , TestContext . Current . CancellationToken ) ;
10011001
10021002 //The operation must have failed.
10031003 Assert . False ( operationResult . IsSuccessStatusCode , "The operation should have failed." ) ;
@@ -1038,7 +1038,7 @@ public async Task VerifyUpdateFlightCodeShareAirlineNotFoundFailure()
10381038 Name = "Update Flight CodeShare Airline Not Found Test" ,
10391039 Destination = DefaultAirportCode ,
10401040 SortDestinationID = DefaultSortDestinationID ,
1041- } ) ;
1041+ } , TestContext . Current . CancellationToken ) ;
10421042
10431043 if ( operationResult . IsSuccessStatusCode && operationResult . DataObject is Flight createdFlight )
10441044 {
@@ -1053,7 +1053,7 @@ public async Task VerifyUpdateFlightCodeShareAirlineNotFoundFailure()
10531053 Name = "Update Flight CodeShare Airline Not Found Test" ,
10541054 Destination = DefaultAirportCode ,
10551055 SortDestinationID = DefaultSortDestinationID ,
1056- } ) ;
1056+ } , TestContext . Current . CancellationToken ) ;
10571057
10581058 //The operation must have failed.
10591059 Assert . False ( operationResult . IsSuccessStatusCode , "The operation should have failed." ) ;
@@ -1094,7 +1094,7 @@ public async Task VerifyUpdateFlightGateNotFoundFailure()
10941094 Name = "Update Flight Gate Not Found Test" ,
10951095 Destination = DefaultAirportCode ,
10961096 SortDestinationID = DefaultSortDestinationID ,
1097- } ) ;
1097+ } , TestContext . Current . CancellationToken ) ;
10981098
10991099 if ( operationResult . IsSuccessStatusCode && operationResult . DataObject is Flight createdFlight )
11001100 {
@@ -1108,7 +1108,7 @@ public async Task VerifyUpdateFlightGateNotFoundFailure()
11081108 Name = "Update Flight Gate Not Found Test" ,
11091109 Destination = DefaultAirportCode ,
11101110 SortDestinationID = DefaultSortDestinationID ,
1111- } ) ;
1111+ } , TestContext . Current . CancellationToken ) ;
11121112
11131113 //The operation must have failed.
11141114 Assert . False ( operationResult . IsSuccessStatusCode , "The operation should have failed." ) ;
@@ -1149,7 +1149,7 @@ public async Task VerifyUpdateFlightSortDestinationNotFoundFailure()
11491149 Name = "Update Flight Sort Destination Not Found Test" ,
11501150 Destination = DefaultAirportCode ,
11511151 SortDestinationID = DefaultSortDestinationID ,
1152- } ) ;
1152+ } , TestContext . Current . CancellationToken ) ;
11531153
11541154 if ( operationResult . IsSuccessStatusCode && operationResult . DataObject is Flight createdFlight )
11551155 {
@@ -1163,7 +1163,7 @@ public async Task VerifyUpdateFlightSortDestinationNotFoundFailure()
11631163 Name = "Update Flight Sort Destination Not Found Test" ,
11641164 Destination = DefaultAirportCode ,
11651165 SortDestinationID = BadSortDestinationID ,
1166- } ) ;
1166+ } , TestContext . Current . CancellationToken ) ;
11671167
11681168 //The operation must have failed.
11691169 Assert . False ( operationResult . IsSuccessStatusCode , "The operation should have failed." ) ;
0 commit comments