internal IEnumerable <T> FromFeedResponseStream <T>(
            Stream stream,
            ResourceType resourceType)
        {
            CosmosArray cosmosArray = CosmosElementSerializer.ToCosmosElements(
                stream,
                resourceType);

            return(CosmosElementSerializer.GetResources <T>(
                       cosmosArray: cosmosArray,
                       serializerCore: this));
        }
 protected ReadFeedResponse(
     HttpStatusCode httpStatusCode,
     CosmosArray cosmosArray,
     CosmosSerializerCore serializerCore,
     Headers responseMessageHeaders,
     CosmosDiagnostics diagnostics)
 {
     this.Count       = cosmosArray.Count;
     this.Headers     = responseMessageHeaders;
     this.StatusCode  = httpStatusCode;
     this.Diagnostics = diagnostics;
     this.Resource    = CosmosElementSerializer.GetResources <T>(
         cosmosArray: cosmosArray,
         serializerCore: serializerCore);
 }
示例#3
0
        public void CosmosElementsToFindArrayWithSerialization()
        {
            using (MemoryStream ms = new MemoryStream(this.payloadBytes))
            {
                CosmosArray array = CosmosElementSerializer.ToCosmosElements(
                    ms,
                    Documents.ResourceType.Document,
                    null);

                IReadOnlyList <ToDoActivity> results = CosmosElementSerializer.GetResources <ToDoActivity>(
                    array,
                    this.serializerCore);

                if (results.Count != 1000)
                {
                    throw new Exception();
                }
            }
        }