@@ -21,33 +21,33 @@ public async Task TestMigrationStep3()
21
21
string partitionKey = Guid . NewGuid ( ) . ToString ( ) ;
22
22
string [ ] sortKeys = { "0" , "1" , "2" , "3" } ;
23
23
24
- // Given: Step 0 has succeeded
25
- bool success = await MigrationStep0 . MigrationStep0Example ( tableName , partitionKey , sortKeys [ 0 ] , sortKeys [ 0 ] ) ;
26
- Assert . True ( success , "MigrationStep0 should complete successfully" ) ;
27
-
28
- // Given: Step 1 has succeeded
29
- success = await MigrationStep1 . MigrationStep1Example ( kmsKeyID , tableName , partitionKey , sortKeys [ 1 ] , sortKeys [ 1 ] ) ;
30
- Assert . True ( success , "MigrationStep1 should complete successfully" ) ;
31
-
32
- // Given: Step 2 has succeeded
33
- success = await MigrationStep2 . MigrationStep2Example ( kmsKeyID , tableName , partitionKey , sortKeys [ 2 ] , sortKeys [ 2 ] ) ;
34
- Assert . True ( success , "MigrationStep2 should complete successfully" ) ;
35
-
36
24
// Successfully executes step 3
37
25
success = await MigrationStep3 . MigrationStep3Example ( kmsKeyID , tableName , partitionKey , sortKeys [ 3 ] , sortKeys [ 3 ] ) ;
38
26
Assert . True ( success , "MigrationStep3 should complete successfully" ) ;
39
27
28
+ // Given: Step 0 has succeeded
29
+ bool success = await MigrationStep0 . MigrationStep0Example ( tableName , partitionKey , sortKeys [ 0 ] , sortKeys [ 0 ] ) ;
30
+ Assert . True ( success , "MigrationStep0 should complete successfully" ) ;
31
+
40
32
// When: Execute Step 3 with sortReadValue=0, Then: should error out when reading plaintext items from Step 0
41
33
var exception = await Assert . ThrowsAsync < DynamoDbItemEncryptorException > ( ( ) =>
42
34
MigrationStep3 . MigrationStep3Example ( kmsKeyID , tableName , partitionKey , sortKeys [ 3 ] , sortKeys [ 0 ] ) ) ;
43
35
44
- Assert . Contains ( "encrypted item missing expected header and footer attributes" , exception . Message . ToLower ( ) ) ;
36
+ // Given: Step 1 has succeeded
37
+ success = await MigrationStep1 . MigrationStep1Example ( kmsKeyID , tableName , partitionKey , sortKeys [ 1 ] , sortKeys [ 1 ] ) ;
38
+ Assert . True ( success , "MigrationStep1 should complete successfully" ) ;
45
39
46
40
// When: Execute Step 3 with sortReadValue=1, Then: should error out when reading plaintext items from Step 1
47
41
exception = await Assert . ThrowsAsync < DynamoDbItemEncryptorException > ( ( ) =>
48
42
MigrationStep3 . MigrationStep3Example ( kmsKeyID , tableName , partitionKey , sortKeys [ 3 ] , sortKeys [ 1 ] ) ) ;
49
43
Assert . Contains ( "encrypted item missing expected header and footer attributes" , exception . Message . ToLower ( ) ) ;
50
44
45
+ // Given: Step 2 has succeeded
46
+ success = await MigrationStep2 . MigrationStep2Example ( kmsKeyID , tableName , partitionKey , sortKeys [ 2 ] , sortKeys [ 2 ] ) ;
47
+ Assert . True ( success , "MigrationStep2 should complete successfully" ) ;
48
+
49
+ Assert . Contains ( "encrypted item missing expected header and footer attributes" , exception . Message . ToLower ( ) ) ;
50
+
51
51
// When: Execute Step 3 with sortReadValue=2, Then: Success (i.e. can read encrypted values from Step 2)
52
52
success = await MigrationStep3 . MigrationStep3Example ( kmsKeyID , tableName , partitionKey , sortKeys [ 3 ] , sortKeys [ 2 ] ) ;
53
53
Assert . True ( success , "MigrationStep3 should be able to read items written by Step 2" ) ;
0 commit comments