Exemple #1
0
        public async Task Test_UploadCategoryImage_GetCategoryImage()
        {
            var categoryId = 2;
            var folder     = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var image      = await File.ReadAllBytesAsync(Path.Combine(folder, "checkmark-green.png"));

            using (var stream = new MemoryStream(image))
            {
                await _client.UploadCategoryImageAsync(categoryId, stream);
            }

            var uploadedImage = await _client.GetCategoryImageAsync(categoryId) as byte[];

            Assert.Equal(image, uploadedImage);
        }
 /// <summary>
 /// Gets an image of a category
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// Category id
 /// </param>
 public static object GetCategoryImage(this INorthwindApiClient operations, int id)
 {
     return(operations.GetCategoryImageAsync(id).GetAwaiter().GetResult());
 }