Rename ProcessState to ImageProcessState

pull/16586/head
Salih 2 years ago
parent f702013c3c
commit 324302426b

@ -121,14 +121,14 @@ public enum ImageResizeMode
The `ImageResizeResult` is a generic class that is used to return the result of the image resize operations. It has the following properties:
* `Result`: The resized image (stream or byte array).
* `State`: The result of the resize operation (type: `ProcessState`).
* `State`: The result of the resize operation (type: `ImageProcessState`).
### ProcessState
### ImageProcessState
The `ProcessState` is an enum that is used to return the the result of the image resize operations. It has the following values:
The `ImageProcessState` is an enum that is used to return the the result of the image resize operations. It has the following values:
```csharp
public enum ProcessState : byte
public enum ImageProcessState : byte
{
Done = 1,
Canceled = 2,
@ -179,14 +179,14 @@ var result = await _imageCompressor.CompressAsync(
The `ImageCompressResult` is a generic class that is used to return the result of the image compression operations. It has the following properties:
* `Result`: The compressed image (stream or byte array).
* `State`: The result of the compress operation (type: `ProcessState`).
* `State`: The result of the compress operation (type: `ImageProcessState`).
### ProcessState
### ImageProcessState
The `ProcessState` is an enum that is used to return the the result of the image compress operations. It has the following values:
The `ImageProcessState` is an enum that is used to return the the result of the image compress operations. It has the following values:
```csharp
public enum ProcessState : byte
public enum ImageProcessState : byte
{
Done = 1,
Canceled = 2,

@ -2,7 +2,7 @@
public class ImageCompressResult<T> : ImageProcessResult<T>
{
public ImageCompressResult(T result, ProcessState state) : base(result, state)
public ImageCompressResult(T result, ImageProcessState state) : base(result, state)
{
}
}

@ -25,7 +25,7 @@ public class ImageCompressor : IImageCompressor, ITransientDependency
{
var result = await imageCompressorContributor.TryCompressAsync(stream, mimeType, CancellationTokenProvider.FallbackToProvider(cancellationToken));
if (result.State == ProcessState.Unsupported)
if (result.State == ImageProcessState.Unsupported)
{
continue;
}
@ -33,7 +33,7 @@ public class ImageCompressor : IImageCompressor, ITransientDependency
return result;
}
return new ImageCompressResult<Stream>(stream, ProcessState.Unsupported);
return new ImageCompressResult<Stream>(stream, ImageProcessState.Unsupported);
}
public virtual async Task<ImageCompressResult<byte[]>> CompressAsync(byte[] bytes, string mimeType = null, CancellationToken cancellationToken = default)
@ -42,7 +42,7 @@ public class ImageCompressor : IImageCompressor, ITransientDependency
{
var result = await imageCompressorContributor.TryCompressAsync(bytes, mimeType, CancellationTokenProvider.FallbackToProvider(cancellationToken));
if (result.State == ProcessState.Unsupported)
if (result.State == ImageProcessState.Unsupported)
{
continue;
}
@ -50,6 +50,6 @@ public class ImageCompressor : IImageCompressor, ITransientDependency
return result;
}
return new ImageCompressResult<byte[]>(bytes, ProcessState.Unsupported);
return new ImageCompressResult<byte[]>(bytes, ImageProcessState.Unsupported);
}
}

@ -3,9 +3,9 @@
public abstract class ImageProcessResult<T>
{
public T Result { get; }
public ProcessState State { get; }
public ImageProcessState State { get; }
protected ImageProcessResult(T result, ProcessState state)
protected ImageProcessResult(T result, ImageProcessState state)
{
Result = result;
State = state;

@ -1,6 +1,6 @@
namespace Volo.Abp.Imaging;
public enum ProcessState : byte
public enum ImageProcessState : byte
{
Done = 1,
Canceled = 2,

@ -2,7 +2,7 @@
public class ImageResizeResult<T> : ImageProcessResult<T>
{
public ImageResizeResult(T result, ProcessState state) : base(result, state)
public ImageResizeResult(T result, ImageProcessState state) : base(result, state)
{
}
}

@ -39,7 +39,7 @@ public class ImageResizer : IImageResizer, ITransientDependency
{
var result = await imageResizerContributor.TryResizeAsync(stream, resizeArgs, mimeType, CancellationTokenProvider.FallbackToProvider(cancellationToken));
if (result.State == ProcessState.Unsupported)
if (result.State == ImageProcessState.Unsupported)
{
continue;
}
@ -47,7 +47,7 @@ public class ImageResizer : IImageResizer, ITransientDependency
return result;
}
return new ImageResizeResult<Stream>(stream, ProcessState.Unsupported);
return new ImageResizeResult<Stream>(stream, ImageProcessState.Unsupported);
}
public virtual async Task<ImageResizeResult<byte[]>> ResizeAsync(
@ -62,7 +62,7 @@ public class ImageResizer : IImageResizer, ITransientDependency
{
var result = await imageResizerContributor.TryResizeAsync(bytes, resizeArgs, mimeType, CancellationTokenProvider.FallbackToProvider(cancellationToken));
if (result.State == ProcessState.Unsupported)
if (result.State == ImageProcessState.Unsupported)
{
continue;
}
@ -70,7 +70,7 @@ public class ImageResizer : IImageResizer, ITransientDependency
return result;
}
return new ImageResizeResult<byte[]>(bytes, ProcessState.Unsupported);
return new ImageResizeResult<byte[]>(bytes, ImageProcessState.Unsupported);
}
protected virtual void ChangeDefaultResizeMode(ImageResizeArgs resizeArgs)

@ -54,7 +54,7 @@ public class CompressImageAttribute : ActionFilterAttribute
var result = await imageCompressor.CompressAsync(file.OpenReadStream(), file.ContentType);
if (result.State != ProcessState.Done)
if (result.State != ImageProcessState.Done)
{
return file;
}
@ -73,7 +73,7 @@ public class CompressImageAttribute : ActionFilterAttribute
var result = await imageCompressor.CompressAsync(remoteStreamContent.GetStream(), remoteStreamContent.ContentType);
if (result.State != ProcessState.Done)
if (result.State != ImageProcessState.Done)
{
return remoteStreamContent;
}
@ -88,7 +88,7 @@ public class CompressImageAttribute : ActionFilterAttribute
{
var result = await imageCompressor.CompressAsync(stream);
if (result.State != ProcessState.Done)
if (result.State != ImageProcessState.Done)
{
return stream;
}

@ -67,7 +67,7 @@ public class ResizeImageAttribute : ActionFilterAttribute
var result = await imageResizer.ResizeAsync(file.OpenReadStream(), new ImageResizeArgs(Width, Height, Mode), file.ContentType);
if (result.State != ProcessState.Done)
if (result.State != ImageProcessState.Done)
{
return file;
}
@ -86,7 +86,7 @@ public class ResizeImageAttribute : ActionFilterAttribute
var result = await imageResizer.ResizeAsync(remoteStreamContent.GetStream(), new ImageResizeArgs(Width, Height, Mode), remoteStreamContent.ContentType);
if (result.State != ProcessState.Done)
if (result.State != ImageProcessState.Done)
{
return remoteStreamContent;
}
@ -101,7 +101,7 @@ public class ResizeImageAttribute : ActionFilterAttribute
{
var result = await imageResizer.ResizeAsync(stream, new ImageResizeArgs(Width, Height, Mode));
if (result.State != ProcessState.Done)
if (result.State != ImageProcessState.Done)
{
return stream;
}

@ -31,25 +31,25 @@ public class ImageSharpImageCompressorContributor : IImageCompressorContributor,
{
if (!string.IsNullOrWhiteSpace(mimeType) && !CanCompress(mimeType))
{
return new ImageCompressResult<Stream>(stream, ProcessState.Unsupported);
return new ImageCompressResult<Stream>(stream, ImageProcessState.Unsupported);
}
var (image, format) = await Image.LoadWithFormatAsync(stream, cancellationToken);
if (!CanCompress(format.DefaultMimeType))
{
return new ImageCompressResult<Stream>(stream, ProcessState.Unsupported);
return new ImageCompressResult<Stream>(stream, ImageProcessState.Unsupported);
}
var memoryStream = await GetStreamFromImageAsync(image, format, cancellationToken);
if (memoryStream.Length < stream.Length)
{
return new ImageCompressResult<Stream>(memoryStream, ProcessState.Done);
return new ImageCompressResult<Stream>(memoryStream, ImageProcessState.Done);
}
memoryStream.Dispose();
return new ImageCompressResult<Stream>(stream, ProcessState.Canceled);
return new ImageCompressResult<Stream>(stream, ImageProcessState.Canceled);
}
public virtual async Task<ImageCompressResult<byte[]>> TryCompressAsync(
@ -59,13 +59,13 @@ public class ImageSharpImageCompressorContributor : IImageCompressorContributor,
{
if (!string.IsNullOrWhiteSpace(mimeType) && !CanCompress(mimeType))
{
return new ImageCompressResult<byte[]>(bytes, ProcessState.Unsupported);
return new ImageCompressResult<byte[]>(bytes, ImageProcessState.Unsupported);
}
using var ms = new MemoryStream(bytes);
var result = await TryCompressAsync(ms, mimeType, cancellationToken);
if (result.State != ProcessState.Done)
if (result.State != ImageProcessState.Done)
{
return new ImageCompressResult<byte[]>(bytes, result.State);
}

@ -21,14 +21,14 @@ public class ImageSharpImageResizerContributor : IImageResizerContributor, ITran
{
if (!string.IsNullOrWhiteSpace(mimeType) && !CanResize(mimeType))
{
return new ImageResizeResult<Stream>(stream, ProcessState.Unsupported);
return new ImageResizeResult<Stream>(stream, ImageProcessState.Unsupported);
}
var (image, format) = await Image.LoadWithFormatAsync(stream, cancellationToken);
if (!CanResize(format.DefaultMimeType))
{
return new ImageResizeResult<Stream>(stream, ProcessState.Unsupported);
return new ImageResizeResult<Stream>(stream, ImageProcessState.Unsupported);
}
if (ResizeModeMap.TryGetValue(resizeArgs.Mode, out var resizeMode))
@ -46,7 +46,7 @@ public class ImageSharpImageResizerContributor : IImageResizerContributor, ITran
{
await image.SaveAsync(memoryStream, format, cancellationToken: cancellationToken);
memoryStream.Position = 0;
return new ImageResizeResult<Stream>(memoryStream, ProcessState.Done);
return new ImageResizeResult<Stream>(memoryStream, ImageProcessState.Done);
}
catch
{
@ -63,14 +63,14 @@ public class ImageSharpImageResizerContributor : IImageResizerContributor, ITran
{
if (!string.IsNullOrWhiteSpace(mimeType) && !CanResize(mimeType))
{
return new ImageResizeResult<byte[]>(bytes, ProcessState.Unsupported);
return new ImageResizeResult<byte[]>(bytes, ImageProcessState.Unsupported);
}
using var ms = new MemoryStream(bytes);
var result = await TryResizeAsync(ms, resizeArgs, mimeType, cancellationToken);
if (result.State != ProcessState.Done)
if (result.State != ImageProcessState.Done)
{
return new ImageResizeResult<byte[]>(bytes, result.State);
}

@ -33,7 +33,7 @@ public class MagickImageCompressorContributor : IImageCompressorContributor, ITr
{
if (!string.IsNullOrWhiteSpace(mimeType) && !CanCompress(mimeType))
{
return new ImageCompressResult<Stream>(stream, ProcessState.Unsupported);
return new ImageCompressResult<Stream>(stream, ImageProcessState.Unsupported);
}
var memoryStream = await stream.CreateMemoryStreamAsync(cancellationToken: cancellationToken);
@ -42,17 +42,17 @@ public class MagickImageCompressorContributor : IImageCompressorContributor, ITr
{
if (!Optimizer.IsSupported(memoryStream))
{
return new ImageCompressResult<Stream>(stream, ProcessState.Unsupported);
return new ImageCompressResult<Stream>(stream, ImageProcessState.Unsupported);
}
if (Compress(memoryStream))
{
return new ImageCompressResult<Stream>(memoryStream, ProcessState.Done);
return new ImageCompressResult<Stream>(memoryStream, ImageProcessState.Done);
}
memoryStream.Dispose();
return new ImageCompressResult<Stream>(stream, ProcessState.Canceled);
return new ImageCompressResult<Stream>(stream, ImageProcessState.Canceled);
}
catch
{
@ -68,13 +68,13 @@ public class MagickImageCompressorContributor : IImageCompressorContributor, ITr
{
if (!string.IsNullOrWhiteSpace(mimeType) && !CanCompress(mimeType))
{
return new ImageCompressResult<byte[]>(bytes, ProcessState.Unsupported);
return new ImageCompressResult<byte[]>(bytes, ImageProcessState.Unsupported);
}
using var memoryStream = new MemoryStream(bytes);
var result = await TryCompressAsync(memoryStream, mimeType, cancellationToken);
if (result.State != ProcessState.Done)
if (result.State != ImageProcessState.Done)
{
return new ImageCompressResult<byte[]>(bytes, result.State);
}

@ -21,7 +21,7 @@ public class MagickImageResizerContributor : IImageResizerContributor, ITransien
{
if (!mimeType.IsNullOrWhiteSpace() && !CanResize(mimeType))
{
return new ImageResizeResult<Stream>(stream, ProcessState.Unsupported);
return new ImageResizeResult<Stream>(stream, ImageProcessState.Unsupported);
}
var memoryStream = await stream.CreateMemoryStreamAsync(cancellationToken: cancellationToken);
@ -32,7 +32,7 @@ public class MagickImageResizerContributor : IImageResizerContributor, ITransien
if (mimeType.IsNullOrWhiteSpace() && !CanResize(image.FormatInfo?.MimeType))
{
return new ImageResizeResult<Stream>(stream, ProcessState.Unsupported);
return new ImageResizeResult<Stream>(stream, ImageProcessState.Unsupported);
}
Resize(image, resizeArgs);
@ -42,7 +42,7 @@ public class MagickImageResizerContributor : IImageResizerContributor, ITransien
memoryStream.SetLength(memoryStream.Position);
memoryStream.Position = 0;
return new ImageResizeResult<Stream>(memoryStream, ProcessState.Done);
return new ImageResizeResult<Stream>(memoryStream, ImageProcessState.Done);
}
catch
{
@ -59,19 +59,19 @@ public class MagickImageResizerContributor : IImageResizerContributor, ITransien
{
if (!mimeType.IsNullOrWhiteSpace() && !CanResize(mimeType))
{
return Task.FromResult(new ImageResizeResult<byte[]>(bytes, ProcessState.Unsupported));
return Task.FromResult(new ImageResizeResult<byte[]>(bytes, ImageProcessState.Unsupported));
}
using var image = new MagickImage(bytes);
if (mimeType.IsNullOrWhiteSpace() && !CanResize(image.FormatInfo?.MimeType))
{
return Task.FromResult(new ImageResizeResult<byte[]>(bytes, ProcessState.Unsupported));
return Task.FromResult(new ImageResizeResult<byte[]>(bytes, ImageProcessState.Unsupported));
}
Resize(image, resizeArgs);
return Task.FromResult(new ImageResizeResult<byte[]>(image.ToByteArray(), ProcessState.Done));
return Task.FromResult(new ImageResizeResult<byte[]>(image.ToByteArray(), ImageProcessState.Done));
}
protected virtual bool CanResize(string mimeType)

@ -20,7 +20,7 @@ public class IImageCompressor_Tests : AbpImagingAbstractionsTestBase
var compressedImage = await ImageCompressor.CompressAsync(jpegImage);
compressedImage.ShouldNotBeNull();
compressedImage.State.ShouldBe(ProcessState.Unsupported);
compressedImage.State.ShouldBe(ImageProcessState.Unsupported);
compressedImage.Result.ShouldBe(jpegImage);
}
@ -32,7 +32,7 @@ public class IImageCompressor_Tests : AbpImagingAbstractionsTestBase
var compressedImage = await ImageCompressor.CompressAsync(pngImage);
compressedImage.ShouldNotBeNull();
compressedImage.State.ShouldBe(ProcessState.Unsupported);
compressedImage.State.ShouldBe(ImageProcessState.Unsupported);
compressedImage.Result.ShouldBe(pngImage);
}
@ -44,7 +44,7 @@ public class IImageCompressor_Tests : AbpImagingAbstractionsTestBase
var compressedImage = await ImageCompressor.CompressAsync(webpImage);
compressedImage.ShouldNotBeNull();
compressedImage.State.ShouldBe(ProcessState.Unsupported);
compressedImage.State.ShouldBe(ImageProcessState.Unsupported);
compressedImage.Result.ShouldBe(webpImage);
}

@ -19,7 +19,7 @@ public class IImageResizer_Tests : AbpImagingAbstractionsTestBase
var resizedImage = await ImageResizer.ResizeAsync(jpegImage, new ImageResizeArgs(100, 100));
resizedImage.ShouldNotBeNull();
resizedImage.State.ShouldBe(ProcessState.Unsupported);
resizedImage.State.ShouldBe(ImageProcessState.Unsupported);
resizedImage.Result.ShouldBe(jpegImage);
}
@ -31,7 +31,7 @@ public class IImageResizer_Tests : AbpImagingAbstractionsTestBase
var resizedImage = await ImageResizer.ResizeAsync(pngImage, new ImageResizeArgs(100, 100));
resizedImage.ShouldNotBeNull();
resizedImage.State.ShouldBe(ProcessState.Unsupported);
resizedImage.State.ShouldBe(ImageProcessState.Unsupported);
resizedImage.Result.ShouldBe(pngImage);
}
@ -43,7 +43,7 @@ public class IImageResizer_Tests : AbpImagingAbstractionsTestBase
var resizedImage = await ImageResizer.ResizeAsync(webpImage, new ImageResizeArgs(100, 100));
resizedImage.ShouldNotBeNull();
resizedImage.State.ShouldBe(ProcessState.Unsupported);
resizedImage.State.ShouldBe(ImageProcessState.Unsupported);
resizedImage.Result.ShouldBe(webpImage);
}

@ -19,7 +19,7 @@ public class ImageSharpImageCompressor_Tests : AbpImagingImageSharpTestBase
var compressedImage = await ImageCompressor.CompressAsync(jpegImage);
compressedImage.ShouldNotBeNull();
compressedImage.State.ShouldBe(ProcessState.Done);
compressedImage.State.ShouldBe(ImageProcessState.Done);
compressedImage.Result.Length.ShouldBeLessThan(jpegImage.Length);
compressedImage.Result.Dispose();
}
@ -32,7 +32,7 @@ public class ImageSharpImageCompressor_Tests : AbpImagingImageSharpTestBase
compressedImage.ShouldNotBeNull();
if (compressedImage.State == ProcessState.Done)
if (compressedImage.State == ImageProcessState.Done)
{
compressedImage.Result.Length.ShouldBeLessThan(pngImage.Length);
}else
@ -49,7 +49,7 @@ public class ImageSharpImageCompressor_Tests : AbpImagingImageSharpTestBase
var compressedImage = await ImageCompressor.CompressAsync(webpImage);
compressedImage.ShouldNotBeNull();
compressedImage.State.ShouldBe(ProcessState.Done);
compressedImage.State.ShouldBe(ImageProcessState.Done);
compressedImage.Result.Length.ShouldBeLessThan(webpImage.Length);
compressedImage.Result.Dispose();
}
@ -64,10 +64,10 @@ public class ImageSharpImageCompressor_Tests : AbpImagingImageSharpTestBase
var compressedImage2 = await ImageCompressor.CompressAsync(byteArr);
compressedImage1.ShouldNotBeNull();
compressedImage1.State.ShouldBe(ProcessState.Done);
compressedImage1.State.ShouldBe(ImageProcessState.Done);
compressedImage2.ShouldNotBeNull();
compressedImage2.State.ShouldBe(ProcessState.Done);
compressedImage2.State.ShouldBe(ImageProcessState.Done);
compressedImage1.Result.Length.ShouldBeLessThan(jpegImage.Length);
compressedImage2.Result.LongLength.ShouldBeLessThan(jpegImage.Length);

@ -21,7 +21,7 @@ public class ImageSharpImageResizer_Tests : AbpImagingImageSharpTestBase
var resizedImage = await ImageResizer.ResizeAsync(jpegImage, new ImageResizeArgs(100, 100));
resizedImage.ShouldNotBeNull();
resizedImage.State.ShouldBe(ProcessState.Done);
resizedImage.State.ShouldBe(ImageProcessState.Done);
resizedImage.Result.Length.ShouldBeLessThan(jpegImage.Length);
}
@ -32,7 +32,7 @@ public class ImageSharpImageResizer_Tests : AbpImagingImageSharpTestBase
var resizedImage = await ImageResizer.ResizeAsync(pngImage, new ImageResizeArgs(100, 100));
resizedImage.ShouldNotBeNull();
resizedImage.State.ShouldBe(ProcessState.Done);
resizedImage.State.ShouldBe(ImageProcessState.Done);
resizedImage.Result.Length.ShouldBeLessThan(pngImage.Length);
}
@ -43,7 +43,7 @@ public class ImageSharpImageResizer_Tests : AbpImagingImageSharpTestBase
var resizedImage = await ImageResizer.ResizeAsync(webpImage, new ImageResizeArgs(100, 100));
resizedImage.ShouldNotBeNull();
resizedImage.State.ShouldBe(ProcessState.Done);
resizedImage.State.ShouldBe(ImageProcessState.Done);
resizedImage.Result.Length.ShouldBeLessThan(webpImage.Length);
}
@ -57,10 +57,10 @@ public class ImageSharpImageResizer_Tests : AbpImagingImageSharpTestBase
var resizedImage2 = await ImageResizer.ResizeAsync(byteArr, new ImageResizeArgs(100, 100));
resizedImage1.ShouldNotBeNull();
resizedImage1.State.ShouldBe(ProcessState.Done);
resizedImage1.State.ShouldBe(ImageProcessState.Done);
resizedImage2.ShouldNotBeNull();
resizedImage2.State.ShouldBe(ProcessState.Done);
resizedImage2.State.ShouldBe(ImageProcessState.Done);
resizedImage1.Result.Length.ShouldBeLessThan(jpegImage.Length);
resizedImage2.Result.LongLength.ShouldBeLessThan(jpegImage.Length);

@ -21,7 +21,7 @@ public class MagickNetImageCompressor_Tests : AbpImagingMagickNetTestBase
var compressedImage = await ImageCompressor.CompressAsync(jpegImage);
compressedImage.ShouldNotBeNull();
compressedImage.State.ShouldBe(ProcessState.Done);
compressedImage.State.ShouldBe(ImageProcessState.Done);
compressedImage.Result.Length.ShouldBeLessThan(jpegImage.Length);
compressedImage.Result.Dispose();
@ -34,7 +34,7 @@ public class MagickNetImageCompressor_Tests : AbpImagingMagickNetTestBase
var compressedImage = await ImageCompressor.CompressAsync(pngImage);
compressedImage.ShouldNotBeNull();
compressedImage.State.ShouldBe(ProcessState.Done);
compressedImage.State.ShouldBe(ImageProcessState.Done);
compressedImage.Result.Length.ShouldBeLessThan(pngImage.Length);
compressedImage.Result.Dispose();
@ -47,7 +47,7 @@ public class MagickNetImageCompressor_Tests : AbpImagingMagickNetTestBase
var compressedImage = await ImageCompressor.CompressAsync(webpImage);
compressedImage.ShouldNotBeNull();
compressedImage.State.ShouldBe(ProcessState.Unsupported);
compressedImage.State.ShouldBe(ImageProcessState.Unsupported);
compressedImage.Result.ShouldBe(webpImage);
}
@ -59,11 +59,11 @@ public class MagickNetImageCompressor_Tests : AbpImagingMagickNetTestBase
var compressedImage2 = await ImageCompressor.CompressAsync(await jpegImage.GetAllBytesAsync());
compressedImage1.ShouldNotBeNull();
compressedImage1.State.ShouldBe(ProcessState.Done);
compressedImage1.State.ShouldBe(ImageProcessState.Done);
compressedImage1.Result.Length.ShouldBeLessThan(jpegImage.Length);
compressedImage2.ShouldNotBeNull();
compressedImage2.State.ShouldBe(ProcessState.Done);
compressedImage2.State.ShouldBe(ImageProcessState.Done);
compressedImage2.Result.LongLength.ShouldBeLessThan(jpegImage.Length);
compressedImage1.Result.Length.ShouldBe(compressedImage2.Result.LongLength);

@ -21,7 +21,7 @@ public class MagickNetImageResizer_Tests : AbpImagingMagickNetTestBase
var resizedImage = await ImageResizer.ResizeAsync(jpegImage, new ImageResizeArgs(100, 100));
resizedImage.ShouldNotBeNull();
resizedImage.State.ShouldBe(ProcessState.Done);
resizedImage.State.ShouldBe(ImageProcessState.Done);
resizedImage.Result.Length.ShouldBeLessThan(jpegImage.Length);
resizedImage.Result.Dispose();
@ -34,7 +34,7 @@ public class MagickNetImageResizer_Tests : AbpImagingMagickNetTestBase
var resizedImage = await ImageResizer.ResizeAsync(pngImage, new ImageResizeArgs(100, 100));
resizedImage.ShouldNotBeNull();
resizedImage.State.ShouldBe(ProcessState.Done);
resizedImage.State.ShouldBe(ImageProcessState.Done);
resizedImage.Result.Length.ShouldBeLessThan(pngImage.Length);
resizedImage.Result.Dispose();
@ -47,7 +47,7 @@ public class MagickNetImageResizer_Tests : AbpImagingMagickNetTestBase
var resizedImage = await ImageResizer.ResizeAsync(webpImage, new ImageResizeArgs(100, 100));
resizedImage.ShouldNotBeNull();
resizedImage.State.ShouldBe(ProcessState.Done);
resizedImage.State.ShouldBe(ImageProcessState.Done);
resizedImage.Result.Length.ShouldBeLessThan(webpImage.Length);
resizedImage.Result.Dispose();
@ -61,11 +61,11 @@ public class MagickNetImageResizer_Tests : AbpImagingMagickNetTestBase
var resizedImage2 = await ImageResizer.ResizeAsync(await jpegImage.GetAllBytesAsync(), new ImageResizeArgs(100, 100));
resizedImage1.ShouldNotBeNull();
resizedImage1.State.ShouldBe(ProcessState.Done);
resizedImage1.State.ShouldBe(ImageProcessState.Done);
resizedImage1.Result.Length.ShouldBeLessThan(jpegImage.Length);
resizedImage2.ShouldNotBeNull();
resizedImage2.State.ShouldBe(ProcessState.Done);
resizedImage2.State.ShouldBe(ImageProcessState.Done);
resizedImage2.Result.LongLength.ShouldBeLessThan(jpegImage.Length);
resizedImage1.Result.Length.ShouldBe(resizedImage2.Result.LongLength);

Loading…
Cancel
Save