From ae8843eb0708509756f1ade746b7ea1812c27d8d Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Wed, 17 Apr 2024 17:46:55 +0800 Subject: [PATCH] Fix unit test --- .../ImageSharpImageCompressor_Tests.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/framework/test/Volo.Abp.Imaging.ImageSharp.Tests/Volo/Abp/Imaging/ImageSharpImageCompressor_Tests.cs b/framework/test/Volo.Abp.Imaging.ImageSharp.Tests/Volo/Abp/Imaging/ImageSharpImageCompressor_Tests.cs index 6c7041ab2e..13c3dfc29a 100644 --- a/framework/test/Volo.Abp.Imaging.ImageSharp.Tests/Volo/Abp/Imaging/ImageSharpImageCompressor_Tests.cs +++ b/framework/test/Volo.Abp.Imaging.ImageSharp.Tests/Volo/Abp/Imaging/ImageSharpImageCompressor_Tests.cs @@ -1,6 +1,9 @@ using System.IO; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Shouldly; +using SixLabors.ImageSharp.Formats.Jpeg; +using SixLabors.ImageSharp.Formats.Webp; using Xunit; namespace Volo.Abp.Imaging; @@ -12,6 +15,24 @@ public class ImageSharpImageCompressor_Tests : AbpImagingImageSharpTestBase { ImageCompressor = GetRequiredService(); } + + protected override void AfterAddApplication(IServiceCollection services) + { + services.Configure(options => + { + options.JpegEncoder = new JpegEncoder + { + Quality = 50 + }; + options.WebpEncoder = new WebpEncoder + { + Quality = 50 + }; + }); + + base.AfterAddApplication(services); + } + [Fact] public async Task Should_Compress_Jpg() {