public void PostGenerateMultipleTest() { // Arrange var request = new PostGenerateMultipleRequest( new GeneratorParamsList { BarcodeBuilders = new List <GeneratorParams> { new GeneratorParams { TypeOfBarcode = EncodeBarcodeType.QR, Text = "Hello world!" }, new GeneratorParams { TypeOfBarcode = EncodeBarcodeType.Code128, Text = "Hello world!" } } } ); // Act using Stream response = _api.PostGenerateMultiple(request); // Assert Assert.IsTrue(response.Length > 0); using FileStream savedFileStream = File.Create(TestFilePath("Test_PostGenerateMultiple.png")); response.CopyTo(savedFileStream); }
/// <summary> /// Generate multiple barcodes and return in response stream /// </summary> /// <param name="request">Request. <see cref="PostGenerateMultipleRequest" /></param> /// <returns> /// <see cref="System.IO.Stream" /> /// </returns> public System.IO.Stream PostGenerateMultiple(PostGenerateMultipleRequest request) { // verify the required parameter 'generatorParamsList' is set if (request.generatorParamsList == null) { throw new ApiException(400, "Missing required parameter 'generatorParamsList' when calling PostGenerateMultiple"); } // create path and map variables string resourcePath = _configuration.GetApiRootUrl() + "/barcode/generateMultiple"; resourcePath = Regex .Replace(resourcePath, "\\*", string.Empty) .Replace("&", "&") .Replace("/?", "?"); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "format", request.format); string postBody = SerializationHelper.Serialize(request.generatorParamsList); // http body (model) parameter return(_apiInvoker.InvokeBinaryApi( resourcePath, "POST", postBody, null, null)); }