public EncryptionFeedIterator(
            EncryptionFeedIterator feedIterator,
            CosmosResponseFactory responseFactory)
        {
            if (!(feedIterator is EncryptionFeedIterator))
            {
                throw new ArgumentOutOfRangeException($"{nameof(feedIterator)} must be of type {nameof(EncryptionFeedIterator)}.");
            }

            this.feedIterator    = feedIterator;
            this.responseFactory = responseFactory;
        }
        public override async Task <FeedResponse <T> > ReadNextAsync(CancellationToken cancellationToken = default)
        {
            ResponseMessage responseMessage;

            if (typeof(T) == typeof(DecryptableItem))
            {
                IReadOnlyCollection <T> resource;
                EncryptionFeedIterator  encryptionFeedIterator = this.feedIterator as EncryptionFeedIterator;
                (responseMessage, resource) = await encryptionFeedIterator.ReadNextWithoutDecryptionAsync <T>(cancellationToken);

                return(DecryptableFeedResponse <T> .CreateResponse(
                           responseMessage,
                           resource));
            }
            else
            {
                responseMessage = await this.feedIterator.ReadNextAsync(cancellationToken);
            }

            return(this.responseFactory.CreateItemFeedResponse <T>(responseMessage));
        }