Skip to content

Commit 16a262f

Browse files
authored
Add the ability to mock TransactGet and MultiTableTransactGet operations (#3433)
1 parent 08307bc commit 16a262f

File tree

10 files changed

+290
-238
lines changed

10 files changed

+290
-238
lines changed

sdk/src/Services/DynamoDBv2/Custom/DataModel/Context.cs

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -289,51 +289,29 @@ public IMultiTableBatchWrite CreateMultiTableBatchWrite(params IBatchWrite[] bat
289289

290290
#region TransactGet
291291

292-
/// <summary>
293-
/// Creates a strongly-typed TransactGet object, allowing
294-
/// a transactional get operation against DynamoDB.
295-
/// </summary>
296-
/// <typeparam name="T">Type of objects to get.</typeparam>
297-
/// <returns>Empty strongly-typed TransactGet object.</returns>
298-
public TransactGet<T> CreateTransactGet<T>()
292+
/// <inheritdoc/>
293+
public ITransactGet<T> CreateTransactGet<T>()
299294
{
300295
return CreateTransactGet<T>((TransactGetConfig)null);
301296
}
302297

303-
/// <summary>
304-
/// Creates a strongly-typed TransactGet object, allowing
305-
/// a transactional get operation against DynamoDB.
306-
/// </summary>
307-
/// <typeparam name="T">Type of objects to get.</typeparam>
308-
/// <param name="operationConfig">Config object which can be used to override that table used.</param>
309-
/// <returns>Empty strongly-typed TransactGet object.</returns>
298+
/// <inheritdoc/>
310299
[Obsolete("Use the CreateTransactGet overload that takes TransactGetConfig instead, since DynamoDBOperationConfig contains properties that are not applicable to BatchGet.")]
311-
public TransactGet<T> CreateTransactGet<T>(DynamoDBOperationConfig operationConfig)
300+
public ITransactGet<T> CreateTransactGet<T>(DynamoDBOperationConfig operationConfig)
312301
{
313302
DynamoDBFlatConfig config = new DynamoDBFlatConfig(operationConfig, this.Config);
314303
return new TransactGet<T>(this, config);
315304
}
316305

317-
/// <summary>
318-
/// Creates a strongly-typed TransactGet object, allowing
319-
/// a transactional get operation against DynamoDB.
320-
/// </summary>
321-
/// <typeparam name="T">Type of objects to get.</typeparam>
322-
/// <param name="transactGetConfig">Config object that can be used to override properties on the table's context for this request.</param>
323-
/// <returns>Empty strongly-typed TransactGet object.</returns>
324-
public TransactGet<T> CreateTransactGet<T>(TransactGetConfig transactGetConfig)
306+
/// <inheritdoc/>
307+
public ITransactGet<T> CreateTransactGet<T>(TransactGetConfig transactGetConfig)
325308
{
326309
DynamoDBFlatConfig config = new DynamoDBFlatConfig(transactGetConfig?.ToDynamoDBOperationConfig(), this.Config);
327310
return new TransactGet<T>(this, config);
328311
}
329312

330-
/// <summary>
331-
/// Creates a MultiTableTransactGet object, composed of multiple
332-
/// individual TransactGet objects.
333-
/// </summary>
334-
/// <param name="transactionParts">Individual TransactGet objects.</param>
335-
/// <returns>Composite MultiTableTransactGet object.</returns>
336-
public MultiTableTransactGet CreateMultiTableTransactGet(params TransactGet[] transactionParts)
313+
/// <inheritdoc/>
314+
public IMultiTableTransactGet CreateMultiTableTransactGet(params ITransactGet[] transactionParts)
337315
{
338316
return new MultiTableTransactGet(transactionParts);
339317
}

sdk/src/Services/DynamoDBv2/Custom/DataModel/IDynamoDBContext.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ public partial interface IDynamoDBContext : IDisposable
277277
/// </summary>
278278
/// <typeparam name="T">Type of objects to get.</typeparam>
279279
/// <returns>Empty strongly-typed TransactGet object.</returns>
280-
TransactGet<T> CreateTransactGet<T>();
280+
ITransactGet<T> CreateTransactGet<T>();
281281

282282
/// <summary>
283283
/// Creates a strongly-typed TransactGet object, allowing
@@ -287,7 +287,7 @@ public partial interface IDynamoDBContext : IDisposable
287287
/// <param name="operationConfig">Config object which can be used to override that table used.</param>
288288
/// <returns>Empty strongly-typed TransactGet object.</returns>
289289
[Obsolete("Use the CreateTransactGet overload that takes TransactGetConfig instead, since DynamoDBOperationConfig contains properties that are not applicable to BatchGet.")]
290-
TransactGet<T> CreateTransactGet<T>(DynamoDBOperationConfig operationConfig = null);
290+
ITransactGet<T> CreateTransactGet<T>(DynamoDBOperationConfig operationConfig = null);
291291

292292
/// <summary>
293293
/// Creates a strongly-typed TransactGet object, allowing
@@ -296,15 +296,15 @@ public partial interface IDynamoDBContext : IDisposable
296296
/// <typeparam name="T">Type of objects to get.</typeparam>
297297
/// <param name="transactGetConfig">Config object that can be used to override properties on the table's context for this request.</param>
298298
/// <returns>Empty strongly-typed TransactGet object.</returns>
299-
TransactGet<T> CreateTransactGet<T>(TransactGetConfig transactGetConfig);
299+
ITransactGet<T> CreateTransactGet<T>(TransactGetConfig transactGetConfig);
300300

301301
/// <summary>
302302
/// Creates a MultiTableTransactGet object, composed of multiple
303303
/// individual TransactGet objects.
304304
/// </summary>
305305
/// <param name="transactionParts">Individual TransactGet objects.</param>
306306
/// <returns>Composite MultiTableTransactGet object.</returns>
307-
MultiTableTransactGet CreateMultiTableTransactGet(params TransactGet[] transactionParts);
307+
IMultiTableTransactGet CreateMultiTableTransactGet(params ITransactGet[] transactionParts);
308308

309309
#endregion
310310

0 commit comments

Comments
 (0)