forked from dlemstra/Magick.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTheStatisticMethod.cs
More file actions
41 lines (33 loc) · 1.23 KB
/
Copy pathTheStatisticMethod.cs
File metadata and controls
41 lines (33 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET.
// Licensed under the Apache License, Version 2.0.
using System;
using ImageMagick;
using Xunit;
namespace Magick.NET.Tests;
public partial class MagickImageTests
{
public class TheStatisticMethod
{
[Fact]
public void ShouldThrowExceptionWhenWidthIsNegative()
{
using var image = new MagickImage(Files.NoisePNG);
Assert.Throws<ArgumentException>("width", () => image.Statistic(StatisticType.Minimum, -1, 1));
}
[Fact]
public void ShouldThrowExceptionWhenHeightIsNegative()
{
using var image = new MagickImage(Files.NoisePNG);
Assert.Throws<ArgumentException>("height", () => image.Statistic(StatisticType.Minimum, 10, -1));
}
[Fact]
public void ShouldChangePixels()
{
using var image = new MagickImage(Files.NoisePNG);
image.Statistic(StatisticType.Minimum, 10, 1);
ColorAssert.Equal(MagickColors.Black, image, 42, 119);
ColorAssert.Equal(new MagickColor("#eeeeeeeeeeee"), image, 90, 120);
ColorAssert.Equal(new MagickColor("#999999999999"), image, 90, 168);
}
}
}