@@ -1337,11 +1337,6 @@ public async Task ReadItemAsync_WithPPAFEnabledAndSingleMasterAccountWithRespons
13371337 bool enablePartitionLevelFailover )
13381338 {
13391339 // Arrange.
1340- if ( enablePartitionLevelFailover )
1341- {
1342- Environment . SetEnvironmentVariable ( ConfigurationManager . PartitionLevelFailoverEnabled , "True" ) ;
1343- }
1344-
13451340 // Enabling fault injection rule to simulate a 503 service unavailable scenario.
13461341 string serviceUnavailableRuleId = "503-rule-" + Guid . NewGuid ( ) . ToString ( ) ;
13471342 FaultInjectionRule serviceUnavailableRule = new FaultInjectionRuleBuilder (
@@ -1370,10 +1365,16 @@ public async Task ReadItemAsync_WithPPAFEnabledAndSingleMasterAccountWithRespons
13701365 if ( json . Length > 0 && json . Contains ( "enablePerPartitionFailoverBehavior" ) )
13711366 {
13721367 JObject parsedDatabaseAccountResponse = JObject . Parse ( json ) ;
1373- parsedDatabaseAccountResponse . Remove ( "enablePerPartitionFailoverBehavior" ) ;
1368+ parsedDatabaseAccountResponse . Property ( "enablePerPartitionFailoverBehavior" ) . Value = enablePartitionLevelFailover . ToString ( ) ;
13741369
1375- HttpResponseMessage interceptedResponse = Newtonsoft . Json . JsonConvert . DeserializeObject < HttpResponseMessage > (
1376- value : parsedDatabaseAccountResponse . ToString ( ) ) ;
1370+ HttpResponseMessage interceptedResponse = new ( )
1371+ {
1372+ StatusCode = response . StatusCode ,
1373+ Content = new StringContent ( parsedDatabaseAccountResponse . ToString ( ) ) ,
1374+ Version = response . Version ,
1375+ ReasonPhrase = response . ReasonPhrase ,
1376+ RequestMessage = response . RequestMessage ,
1377+ } ;
13771378
13781379 return interceptedResponse ;
13791380 }
0 commit comments