public async Task DynamoDbService_Should_Add_A_Record_To_A_DynamoDb_Table() { var tableName = Guid.NewGuid().ToString(); var dynamoDbOperationConfig = new DynamoDBOperationConfig() { OverrideTableName = tableName }; await CreateTestTable(tableName); Table targetTable = DynamoDbContext.GetTargetTable <MovieEntity>(dynamoDbOperationConfig); var movieEntity = new Fixture().Create <MovieEntity>(); string modelJson = JsonSerializer.Serialize(movieEntity); Document item = Document.FromJson(modelJson); await targetTable.PutItemAsync(item); dynamoDbOperationConfig.IndexName = TestConstants.MoiveTableMovieIdGsi; List <MovieEntity> movieEntities = await DynamoDbContext.QueryAsync <MovieEntity>(movieEntity.MovieId, dynamoDbOperationConfig).GetRemainingAsync(); Assert.True(movieEntity.DeepEquals(movieEntities.First())); }
public async Task <QueryEntityResponse <TEntity> > ToResponseAsync(CancellationToken cancellationToken = default) { var tableName = _context.Config.Metadata.GetOrAddClassInfo(typeof(TEntity)).GetTableName(); return(await _context.QueryAsync <TEntity>(tableName, GetNode(), cancellationToken).ConfigureAwait(false)); }