feat: Replace Moq and FluentAssertions with NSubstitute and Shouldly in test projects

This commit is contained in:
MaddoScientisto 2026-03-12 19:40:58 +01:00
commit 41d9dacfac
6 changed files with 96 additions and 91 deletions

View file

@ -12,8 +12,8 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="MSTest.TestAdapter" Version="4.1.0" />
<PackageReference Include="MSTest.TestFramework" Version="4.1.0" />
<PackageReference Include="FluentAssertions" Version="8.8.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.3" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="2.1.7" />

View file

@ -3,6 +3,7 @@ using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SixLabors.ImageSharp.PixelFormats;
using MaddoShared.ImageSharpTests.Helpers;
using Shouldly;
namespace MaddoShared.ImageSharpTests.Tests
{
@ -36,8 +37,8 @@ namespace MaddoShared.ImageSharpTests.Tests
var outPath = Path.Combine(ws.DestDir.FullName, state.NomeFileBig);
using var outImg = SixLabors.ImageSharp.Image.Load<Rgba32>(outPath);
Assert.AreEqual(800, outImg.Width);
Assert.AreEqual(600, outImg.Height);
outImg.Width.ShouldBe(800);
outImg.Height.ShouldBe(600);
}
}
}

View file

@ -3,6 +3,7 @@ using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SixLabors.ImageSharp.PixelFormats;
using MaddoShared.ImageSharpTests.Helpers;
using Shouldly;
namespace MaddoShared.ImageSharpTests.Tests
{
@ -43,8 +44,8 @@ namespace MaddoShared.ImageSharpTests.Tests
// top band (upper 25%)
var topCount = PixelInspector.CountNonBackgroundPixels(outPath, 0, 0, 800, (int)(600 * 0.25), new Rgba32(255, 255, 255, 255), tolerance: 10);
Assert.IsTrue(bottomCount > 50, $"Expected text pixels in bottom band, found {bottomCount}");
Assert.IsTrue(bottomCount > topCount, "Expected more non-background pixels at bottom than top");
(bottomCount > 50).ShouldBeTrue($"Expected text pixels in bottom band, found {bottomCount}");
(bottomCount > topCount).ShouldBeTrue("Expected more non-background pixels at bottom than top");
}
}
}