public void RemoveBatchPoolParametersTest() { // Setup cmdlet without the required parameters BatchAccountContext context = BatchTestHelpers.CreateBatchContextWithKeys(); cmdlet.BatchContext = context; // Setup cmdlet to skip confirmation popup cmdlet.Force = true; commandRuntimeMock.Setup(f => f.ShouldProcess(It.IsAny <string>(), It.IsAny <string>())).Returns(true); Assert.Throws <ArgumentNullException>(() => cmdlet.ExecuteCmdlet()); cmdlet.Name = "testPool"; // Don't go to the service on a DeletePool call YieldInjectionInterceptor interceptor = new YieldInjectionInterceptor((opContext, request) => { if (request is DeletePoolRequest) { DeletePoolResponse response = new DeletePoolResponse(); Task <object> task = Task <object> .Factory.StartNew(() => { return(response); }); return(task); } return(null); }); cmdlet.AdditionalBehaviors = new List <BatchClientBehavior>() { interceptor }; // Verify no exceptions when required parameters are set cmdlet.ExecuteCmdlet(); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { DeletePoolResponse response = new DeletePoolResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("CreatedTimestamp", targetDepth)) { var unmarshaller = DateTimeUnmarshaller.Instance; response.CreatedTimestamp = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("MessageType", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.MessageType = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("OptOutListName", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.OptOutListName = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("PoolArn", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.PoolArn = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("PoolId", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.PoolId = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("SelfManagedOptOutsEnabled", targetDepth)) { var unmarshaller = BoolUnmarshaller.Instance; response.SelfManagedOptOutsEnabled = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("SharedRoutesEnabled", targetDepth)) { var unmarshaller = BoolUnmarshaller.Instance; response.SharedRoutesEnabled = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Status", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Status = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("TwoWayChannelArn", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.TwoWayChannelArn = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("TwoWayEnabled", targetDepth)) { var unmarshaller = BoolUnmarshaller.Instance; response.TwoWayEnabled = unmarshaller.Unmarshall(context); continue; } } return(response); }