Skip to content

Commit 9ca55db

Browse files
authored
Merge pull request #3450 from aws/feature/v4-ddb-mock
feat: Add the ability to mock DynamoDB operations
2 parents 30f26e4 + c5487d5 commit 9ca55db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3712
-2251
lines changed

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

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,38 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16-
using Amazon.DynamoDBv2.DataModel;
1716
using Amazon.DynamoDBv2.DocumentModel;
1817

1918
namespace Amazon.DynamoDBv2.DataModel
2019
{
20+
/// <summary>
21+
/// Interface retrieving search results (Query or Scan)
22+
/// from DynamoDB.
23+
/// </summary>
24+
public partial interface IAsyncSearch<T>
25+
{
26+
/// <summary>
27+
/// Flag that, if true, indicates that the search is done
28+
/// </summary>
29+
bool IsDone { get; }
30+
31+
/// <summary>
32+
/// Pagination token corresponding to the item where the search operation stopped,
33+
/// inclusive of the previous result set. Use this value to start a new
34+
/// operation to resume search from the next item.
35+
/// </summary>
36+
string PaginationToken { get; }
37+
}
38+
2139
/// <summary>
2240
/// A strongly-typed object for retrieving search results (Query or Scan)
2341
/// from DynamoDB.
2442
/// </summary>
25-
public partial class AsyncSearch<T>
43+
public partial class AsyncSearch<T> : IAsyncSearch<T>
2644
{
27-
#region Constructor
45+
private Search _documentSearch { get; set; }
46+
private DynamoDBContext _sourceContext { get; set; }
47+
private DynamoDBFlatConfig _config { get; set; }
2848

2949
/// <summary>
3050
/// This constructor is used for mocking. Users that want to mock AsyncSearch can create a subclass of AsyncSearch and make a public parameterless constructor.
@@ -36,47 +56,27 @@ protected AsyncSearch()
3656

3757
internal AsyncSearch(DynamoDBContext source, DynamoDBContext.ContextSearch contextSearch)
3858
{
39-
SourceContext = source;
40-
DocumentSearch = contextSearch.Search;
41-
Config = contextSearch.FlatConfig;
59+
_sourceContext = source;
60+
_documentSearch = contextSearch.Search;
61+
_config = contextSearch.FlatConfig;
4262
}
4363

44-
#endregion
45-
46-
#region Private members
47-
48-
private Search DocumentSearch { get; set; }
49-
private DynamoDBContext SourceContext { get; set; }
50-
private DynamoDBFlatConfig Config { get; set; }
51-
52-
#endregion
53-
54-
#region Public properties
55-
56-
/// <summary>
57-
/// Flag that, if true, indicates that the search is done
58-
/// </summary>
64+
/// <inheritdoc/>
5965
public virtual bool IsDone
6066
{
6167
get
6268
{
63-
return DocumentSearch.IsDone;
69+
return _documentSearch.IsDone;
6470
}
6571
}
6672

67-
/// <summary>
68-
/// Pagination token corresponding to the item where the search operation stopped,
69-
/// inclusive of the previous result set. Use this value to start a new
70-
/// operation to resume search from the next item.
71-
/// </summary>
73+
/// <inheritdoc/>
7274
public virtual string PaginationToken
7375
{
7476
get
7577
{
76-
return DocumentSearch.PaginationToken;
78+
return _documentSearch.PaginationToken;
7779
}
7880
}
79-
80-
#endregion
8181
}
8282
}

0 commit comments

Comments
 (0)