Skip to content

Commit

Permalink
tests: update tests following code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Gounlaf committed May 3, 2024
1 parent 4197d68 commit 0c5539c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public partial class MomentsTests
public class TheGetChannelMethod
{
[Fact]
public void ShouldThrowExceptionWhenChannelDoesNotExist()
public void ShouldReturnNullWhenChannelDoesNotExist()
{
using var image = new MagickImage(Files.ImageMagickJPG);
var moments = image.Moments();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public partial class PerceptualHashTests
public class TheGetChannelMethod
{
[Fact]
public void ShouldThrowExceptionWhenChannelDoesNotExist()
public void ShouldReturnNullWhenChannelDoesNotExist()
{
var hash = new PerceptualHash("81b4488652898d48a7a9622346206e620f8a646682939835e986ec98c78f887ae8c67f81b1e884c58a0d18af2d622718fd35623ffdeac9a78cbaedaa81d888434e824c683ad781c37895978c8688c426628ed61b216279b81b48887318a1628af43622a2619d162372");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ public partial class PerceptualHashTests
public class TestPerceptualHash : IPerceptualHash
{
public IChannelPerceptualHash GetChannel(PixelChannel channel)
{
return null;
}
=> null;

public double SumSquaredDistance(IPerceptualHash other)
{
Expand All @@ -29,8 +27,10 @@ public void ShouldThrowNotSupportedExceptionIfCustomImplementationDoesNotHaveExp
{
using var image = new MagickImage(Files.ImageMagickJPG);
var phash = image.PerceptualHash();
Assert.NotNull(phash);

Assert.Throws<NotSupportedException>(() => phash.SumSquaredDistance(new TestPerceptualHash()));
var exception = Assert.Throws<NotSupportedException>(() => phash.SumSquaredDistance(new TestPerceptualHash()));
Assert.Equal("other IPerceptualHash must have Red, Green and Blue channel", exception.Message);
}

[Fact]
Expand Down

0 comments on commit 0c5539c

Please sign in to comment.