mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 18:21:10 +00:00
Standardizes test projects against conventions
This commit is contained in:
1 parent
59e16d645a
commit
ced1f778c4
78 files changed
+283
-201
No files matched your search
@@ -1,46 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.PhotoLibrary;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Formats;
|
||||
using SixLabors.ImageSharp.Formats.Bmp;
|
||||
using SixLabors.ImageSharp.Formats.Gif;
|
||||
using SixLabors.ImageSharp.Formats.Jpeg;
|
||||
using SixLabors.ImageSharp.Formats.Png;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using Xunit;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Fixtures.Common.Enums.PhotoLibrary;
|
||||
|
||||
/// <summary>
|
||||
/// Test-support class providing image byte data for each supported <see cref="ImageType"/>.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ImageTypeFixture : TheoryData<ImageType, byte[]>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ImageTypeFixture"/> class.
|
||||
/// </summary>
|
||||
public ImageTypeFixture()
|
||||
{
|
||||
Add(ImageType.JPEG, CreateImage(new JpegEncoder()));
|
||||
Add(ImageType.PNG, CreateImage(new PngEncoder()));
|
||||
Add(ImageType.BMP, CreateImage(new BmpEncoder()));
|
||||
Add(ImageType.GIF, CreateImage(new GifEncoder()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a byte array representing a thumbnail fixture.
|
||||
/// </summary>
|
||||
/// <param name="encoder">The encoder used for the image.</param>
|
||||
/// <returns>The byte array of the created image.</returns>
|
||||
private static byte[] CreateImage(IImageEncoder encoder)
|
||||
{
|
||||
using Image<Rgba32> image = new(10, 10);
|
||||
using MemoryStream ms = new();
|
||||
image.Save(ms, encoder);
|
||||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user