3de1b04cb4
+ Tests for common core
34 lines
894 B
C#
34 lines
894 B
C#
using FluentAssertions;
|
|
using OpenCvSharp;
|
|
using Squirrowse.Core.Services;
|
|
using Xunit;
|
|
|
|
namespace Squirrowse.Core.Tests
|
|
{
|
|
public class ImgExtensionTests
|
|
{
|
|
private readonly Mat sampleMat = new Mat(500, 600, MatType.CV_8UC3);
|
|
|
|
[SkippableFact]
|
|
public void ByteShouldBeConvertedToMat()
|
|
{
|
|
//
|
|
Skip.If(true, "Cannot use fluent assertion in this kind of test (compare pointer to obj)");
|
|
//
|
|
var bytes = sampleMat.ConvertToJpgByte();
|
|
|
|
var reMet = bytes.ConvertByteToMat();
|
|
|
|
reMet.Should().BeEquivalentTo(sampleMat);
|
|
}
|
|
|
|
[Fact]
|
|
public void MatShouldBeConvertedToByteArr()
|
|
{
|
|
var newByteArr = sampleMat.ConvertToJpgByte();
|
|
|
|
newByteArr.Should().BeOfType(typeof(byte[]));
|
|
newByteArr.Should().NotBeNullOrEmpty();
|
|
}
|
|
}
|
|
} |