@@ -31,7 +31,8 @@ public async Task CreateRecipe_InsertsRecipeAndRevisionAndReturnsId()
3131 this . modelFactory . BuildRecipe ( setOptionalAttributes : true ) ) ;
3232 await this . DatabaseFixture . InsertEntities ( currentUser ) ;
3333
34- var id = await this . recipeManager . CreateRecipe ( attributes , currentUser . Id ) ;
34+ var id = await this . recipeManager . CreateRecipe (
35+ attributes , currentUser . Id , TestContext . Current . CancellationToken ) ;
3536
3637 using var dbContext = this . DatabaseFixture . CreateDbContext ( ) ;
3738
@@ -86,7 +87,8 @@ public async Task CreateRecipe_AcceptsNullForOptionalAttributes()
8687 this . modelFactory . BuildRecipe ( setOptionalAttributes : false ) ) ;
8788 await this . DatabaseFixture . InsertEntities ( currentUser ) ;
8889
89- var id = await this . recipeManager . CreateRecipe ( attributes , currentUser . Id ) ;
90+ var id = await this . recipeManager . CreateRecipe (
91+ attributes , currentUser . Id , TestContext . Current . CancellationToken ) ;
9092
9193 using var dbContext = this . DatabaseFixture . CreateDbContext ( ) ;
9294
@@ -112,7 +114,8 @@ public async Task DeleteRecipe_SetsSoftDeleteAttributesAndReturnsTrue()
112114 var currentUser = this . modelFactory . BuildUser ( ) ;
113115 await this . DatabaseFixture . InsertEntities ( original , currentUser ) ;
114116
115- Assert . True ( await this . recipeManager . DeleteRecipe ( original . Id , currentUser . Id ) ) ;
117+ Assert . True ( await this . recipeManager . DeleteRecipe (
118+ original . Id , currentUser . Id , TestContext . Current . CancellationToken ) ) ;
116119
117120 using var dbContext = this . DatabaseFixture . CreateDbContext ( ) ;
118121
@@ -133,7 +136,8 @@ public async Task DeleteRecipe_DoesNotUpdateAttributesAndReturnsFalseIfAlreadySo
133136 var currentUser = this . modelFactory . BuildUser ( ) ;
134137 await this . DatabaseFixture . InsertEntities ( original , currentUser ) ;
135138
136- Assert . False ( await this . recipeManager . DeleteRecipe ( original . Id , currentUser . Id ) ) ;
139+ Assert . False ( await this . recipeManager . DeleteRecipe (
140+ original . Id , currentUser . Id , TestContext . Current . CancellationToken ) ) ;
137141
138142 using var dbContext = this . DatabaseFixture . CreateDbContext ( ) ;
139143
@@ -148,8 +152,8 @@ public async Task DeleteRecipe_ReturnsFalseIfRecordNotFound()
148152 var currentUser = this . modelFactory . BuildUser ( ) ;
149153 await this . DatabaseFixture . InsertEntities ( this . modelFactory . BuildRecipe ( ) , currentUser ) ;
150154
151- Assert . False (
152- await this . recipeManager . DeleteRecipe ( this . modelFactory . NextInt ( ) , currentUser . Id ) ) ;
155+ Assert . False ( await this . recipeManager . DeleteRecipe (
156+ this . modelFactory . NextInt ( ) , currentUser . Id , TestContext . Current . CancellationToken ) ) ;
153157 }
154158
155159 #endregion
@@ -162,7 +166,8 @@ public async Task HardDeleteRecipe_HardDeletesRecipeAndReturnsTrue()
162166 var recipe = this . modelFactory . BuildRecipe ( ) ;
163167 await this . DatabaseFixture . InsertEntities ( recipe ) ;
164168
165- Assert . True ( await this . recipeManager . HardDeleteRecipe ( recipe . Id ) ) ;
169+ Assert . True ( await this . recipeManager . HardDeleteRecipe (
170+ recipe . Id , TestContext . Current . CancellationToken ) ) ;
166171
167172 using var dbContext = this . DatabaseFixture . CreateDbContext ( ) ;
168173
@@ -174,7 +179,8 @@ public async Task HardDeleteRecipe_ReturnsFalseIfRecordNotFound()
174179 {
175180 await this . DatabaseFixture . InsertEntities ( this . modelFactory . BuildRecipe ( ) ) ;
176181
177- Assert . False ( await this . recipeManager . HardDeleteRecipe ( this . modelFactory . NextInt ( ) ) ) ;
182+ Assert . False ( await this . recipeManager . HardDeleteRecipe (
183+ this . modelFactory . NextInt ( ) , TestContext . Current . CancellationToken ) ) ;
178184 }
179185
180186 #endregion
@@ -192,7 +198,11 @@ public async Task UpdateRecipe_UpdatesRecipeInsertsRevisionAndReturnsTrue()
192198 this . modelFactory . BuildRecipe ( setOptionalAttributes : true ) ) ;
193199
194200 Assert . True ( await this . recipeManager . UpdateRecipe (
195- original . Id , newAttributes , original . Revision , currentUser . Id ) ) ;
201+ original . Id ,
202+ newAttributes ,
203+ original . Revision ,
204+ currentUser . Id ,
205+ TestContext . Current . CancellationToken ) ) ;
196206
197207 using var dbContext = this . DatabaseFixture . CreateDbContext ( ) ;
198208
@@ -250,7 +260,11 @@ public async Task UpdateRecipe_AcceptsNullForOptionalAttributes()
250260 this . modelFactory . BuildRecipe ( setOptionalAttributes : false ) ) ;
251261
252262 Assert . True ( await this . recipeManager . UpdateRecipe (
253- original . Id , newAttributes , original . Revision , currentUser . Id ) ) ;
263+ original . Id ,
264+ newAttributes ,
265+ original . Revision ,
266+ currentUser . Id ,
267+ TestContext . Current . CancellationToken ) ) ;
254268
255269 using var dbContext = this . DatabaseFixture . CreateDbContext ( ) ;
256270 var actual = await dbContext . Recipes . FindAsync (
@@ -273,7 +287,11 @@ public async Task UpdateRecipe_ReturnsFalseAndDoesNotUpdateIfAttributesAlreadyMa
273287 await this . DatabaseFixture . InsertEntities ( original , currentUser ) ;
274288
275289 Assert . False ( await this . recipeManager . UpdateRecipe (
276- original . Id , new ( original ) , original . Revision , currentUser . Id ) ) ;
290+ original . Id ,
291+ new ( original ) ,
292+ original . Revision ,
293+ currentUser . Id ,
294+ TestContext . Current . CancellationToken ) ) ;
277295
278296 using var dbContext = this . DatabaseFixture . CreateDbContext ( ) ;
279297 var expected = original with { CreatedByUser = null , ModifiedByUser = null } ;
@@ -293,7 +311,11 @@ public async Task UpdateRecipe_ThrowsIfRecordNotFound()
293311 var id = this . modelFactory . NextInt ( ) ;
294312 var exception = await Assert . ThrowsAsync < NotFoundException > (
295313 ( ) => this . recipeManager . UpdateRecipe (
296- id , new ( this . modelFactory . BuildRecipe ( ) ) , 0 , currentUser . Id ) ) ;
314+ id ,
315+ new ( this . modelFactory . BuildRecipe ( ) ) ,
316+ 0 ,
317+ currentUser . Id ,
318+ TestContext . Current . CancellationToken ) ) ;
297319
298320 Assert . Equal ( $ "Recipe/{ id } not found", exception . Message ) ;
299321 }
@@ -307,7 +329,11 @@ public async Task UpdateRecipe_ThrowsIfRecipeSoftDeleted()
307329
308330 var exception = await Assert . ThrowsAsync < SoftDeletedException > (
309331 ( ) => this . recipeManager . UpdateRecipe (
310- recipe . Id , new ( this . modelFactory . BuildRecipe ( ) ) , recipe . Revision , currentUser . Id ) ) ;
332+ recipe . Id ,
333+ new ( this . modelFactory . BuildRecipe ( ) ) ,
334+ recipe . Revision ,
335+ currentUser . Id ,
336+ TestContext . Current . CancellationToken ) ) ;
311337
312338 Assert . Equal ( $ "Cannot update soft-deleted recipe { recipe . Id } ", exception . Message ) ;
313339 }
@@ -322,7 +348,11 @@ public async Task UpdateRecipe_ThrowsIfRevisionOutOfSync()
322348 var staleRevision = recipe . Revision - 1 ;
323349 var exception = await Assert . ThrowsAsync < ConcurrencyException > (
324350 ( ) => this . recipeManager . UpdateRecipe (
325- recipe . Id , new ( this . modelFactory . BuildRecipe ( ) ) , staleRevision , currentUser . Id ) ) ;
351+ recipe . Id ,
352+ new ( this . modelFactory . BuildRecipe ( ) ) ,
353+ staleRevision ,
354+ currentUser . Id ,
355+ TestContext . Current . CancellationToken ) ) ;
326356
327357 Assert . Equal (
328358 $ "Revision { staleRevision } does not match current revision { recipe . Revision } ",
0 commit comments