Squirrowse/Squirrowse.Core.Tests/ImgExtensionTests.cs
danielgrabowski 3de1b04cb4 + common packages
+ Tests for common core
2019-10-31 17:00:52 +01:00

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();
}
}
}