private static void UnmarshallResult(XmlUnmarshallerContext context, GetSendQuotaResponse response) { int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; if (context.IsStartOfDocument) { targetDepth += 2; } while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("Max24HourSend", targetDepth)) { response.Max24HourSend = DoubleUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("MaxSendRate", targetDepth)) { response.MaxSendRate = DoubleUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("SentLast24Hours", targetDepth)) { response.SentLast24Hours = DoubleUnmarshaller.GetInstance().Unmarshall(context); continue; } } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { return; } } return; }
public void SesParseQuota() { var text = @"<GetSendQuotaResponse xmlns=""http://ses.amazonaws.com/doc/2010-12-01/""> <GetSendQuotaResult> <SentLast24Hours>127.0</SentLast24Hours> <Max24HourSend>200.0</Max24HourSend> <MaxSendRate>1.0</MaxSendRate> </GetSendQuotaResult> <ResponseMetadata> <RequestId>273021c6-c866-11e0-b926-699e21c3af9e</RequestId> </ResponseMetadata> </GetSendQuotaResponse>"; var getQuotaResponse = GetSendQuotaResponse.Parse(text); Assert.Equal(127f, getQuotaResponse.GetSendQuotaResult.SentLast24Hours); Assert.Equal(200f, getQuotaResponse.GetSendQuotaResult.Max24HourSend); Assert.Equal(1f, getQuotaResponse.GetSendQuotaResult.MaxSendRate); }
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) { GetSendQuotaResponse response = new GetSendQuotaResponse(); while (context.Read()) { if (context.IsStartElement) { if (context.TestExpression("GetSendQuotaResult", 2)) { response.GetSendQuotaResult = GetSendQuotaResultUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("ResponseMetadata", 2)) { response.ResponseMetadata = ResponseMetadataUnmarshaller.GetInstance().Unmarshall(context); } } } return(response); }