Ejemplo n.º 1
0
        public void ComparisonImagesStreamTest()
        {
            ComparisonImagesStreamRequest request = new ComparisonImagesStreamRequest(GetComparisonRequest("source.docx", new List <string> {
                "target.docx"
            }));
            var response = ComparisonApi.ComparisonImagesStream(request);

            Assert.IsInstanceOf <System.IO.Stream>(response, "response is System.IO.Stream");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns image&#39;s streams of document with the result of comparison
        /// </summary>
        /// <param name="request">Request. <see cref="ComparisonImagesStreamRequest" /></param>
        /// <returns><see cref="System.IO.Stream"/></returns>
        public System.IO.Stream ComparisonImagesStream(ComparisonImagesStreamRequest request)
        {
            // create path and map variables
            var resourcePath = this.configuration.GetApiRootUrl() + "/comparison/compareDocuments/stream/images";

            resourcePath = Regex
                           .Replace(resourcePath, "\\*", string.Empty)
                           .Replace("&amp;", "&")
                           .Replace("/?", "?");
            var postBody = SerializationHelper.Serialize(request.Request); // http body (model) parameter

            try
            {
                var response = this.apiInvoker.InvokeBinaryApi(
                    resourcePath,
                    "POST",
                    postBody,
                    null,
                    null);
                if (response != null)
                {
                    return(response);
                }

                return(null);
            }
            catch (ApiException ex)
            {
                if (ex.ErrorCode == 404)
                {
                    return(null);
                }

                throw;
            }
        }