Skip to content

Add the ability to mock BatchWrite and MultiTableBatchWrite operations #3429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

96malhar
Copy link
Contributor

@96malhar 96malhar commented Aug 7, 2024

Description

This PR adds the ability to mock BatchWrite and MultiTableBatchWrite operations in DynamoDB.

  • The IDynamoDBContext.CreateBatchWrite<T>(...) methods now returns a generic IBatchWrite<T> interface
  • The IDynamoDBContext.CreateMultiTableBatchWrite(...) method now returns a IMultiTableBatchWrite interface.

The IBatchWrite<T> interface also implements the non generic IBatchWrite which defines the Execute and ExecuteAsync method to carry out the BatchWrite operations.

I have added new unit tests to showcase how a user will mock these interfaces.

Motivation and Context

DOTNET-7676

Testing

  • Added new unit tests.
  • All existing unit and integrations tests pass.

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed

License

  • I confirm that this pull request can be released under the Apache 2 license

@96malhar 96malhar added the v4 label Aug 7, 2024
@96malhar 96malhar requested a review from normj August 7, 2024 03:54
@@ -69,6 +69,6 @@
<ItemGroup>
<PackageReference Include="System.Buffers" Version="4.5.1" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Text.Json" Version="8.0.3" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I bumped up this package version because 8.0.3 was being flagged for a vulnerability. Since we have enabled "treat warning as errors", this led to compilation failures

@jnunn-aws jnunn-aws requested a review from philasmar August 8, 2024 17:27
@96malhar 96malhar merged commit e9abe86 into feature/v4-ddb-mock Aug 9, 2024
1 check passed
@96malhar 96malhar deleted the kmalhar/mock-batchwrite branch August 9, 2024 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants