public virtual async Task MaterializeAsync <TIncludedDoc>(SearchIndexResponse <TIncludedDoc> response, HttpResponseMessage httpResponse)
 {
     using (var content = await httpResponse.Content.ReadAsStreamAsync().ForAwait())
     {
         Serializer.Populate(response, content);
     }
 }
Пример #2
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            SearchIndexResponse response = new SearchIndexResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("nextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("thingGroups", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <ThingGroupDocument, ThingGroupDocumentUnmarshaller>(ThingGroupDocumentUnmarshaller.Instance);
                    response.ThingGroups = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("things", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <ThingDocument, ThingDocumentUnmarshaller>(ThingDocumentUnmarshaller.Instance);
                    response.Things = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
 protected async virtual void OnSuccessfulResponse <TIncludedDoc>(SearchIndexResponse <TIncludedDoc> response, HttpResponseMessage httpResponse)
 {
     using (var content = await httpResponse.Content.ReadAsStreamAsync().ForAwait())
     {
         EntitySerializer.Populate(response, content);
     }
 }
Пример #4
0
 protected virtual void MaterializeFailedResponse <TIncludedDoc>(SearchIndexResponse <TIncludedDoc> response, HttpResponseMessage httpResponse)
 {
     FailedResponseMaterializer.Materialize(response, httpResponse);
 }
Пример #5
0
 public SearcIndexResponseAssertions(SearchIndexResponse response) : base(response)
 {
 }
Пример #6
0
 public static SearcIndexResponseAssertions <TIncludedDoc> Should <TIncludedDoc>(this SearchIndexResponse <TIncludedDoc> response)
 {
     return(new SearcIndexResponseAssertions <TIncludedDoc>(response));
 }
Пример #7
0
 public static SearcIndexResponseAssertions Should(this SearchIndexResponse response)
 {
     return(new SearcIndexResponseAssertions(response));
 }