diff --git a/tests/Magick.NET.Tests/Drawing/DrawableBezierTests/TheConstructor.cs b/tests/Magick.NET.Tests/Drawing/DrawableBezierTests/TheConstructor.cs new file mode 100644 index 0000000000..dcce927754 --- /dev/null +++ b/tests/Magick.NET.Tests/Drawing/DrawableBezierTests/TheConstructor.cs @@ -0,0 +1,51 @@ +// Copyright Dirk Lemstra https://github.com/dlemstra/Magick.NET. +// Licensed under the Apache License, Version 2.0. + +using System; +using System.Linq; +using ImageMagick; +using Xunit; + +namespace Magick.NET.Tests; + +public partial class DrawableBezierTests +{ + public class TheConstructor + { + [Fact] + public void ShouldSetPathsToEmptyCollection() + { + PointD[] coordinates = [new PointD(0, 0), new PointD(50, 50), new PointD(99, 99)]; + + var bezier = new DrawableBezier(coordinates.ToList()); + Assert.Equal(3, bezier.Coordinates.Count); + } + + [Fact] + public void ShouldThrowExceptionWhenCoordinatesAreNotSpecified() + { + Assert.Throws("coordinates", () => + { + new DrawableBezier(); + }); + } + + [Fact] + public void ShouldThrowExceptionWhenCoordinatesAreNull() + { + Assert.Throws("coordinates", () => + { + new DrawableBezier(null); + }); + } + + [Fact] + public void ShouldThrowExceptionWhenCoordinatesAreEmpty() + { + Assert.Throws("coordinates", () => + { + new DrawableBezier([]); + }); + } + } +} diff --git a/tests/Magick.NET.Tests/Drawing/DrawableTests.cs b/tests/Magick.NET.Tests/Drawing/DrawableTests.cs index a550a3e358..7b953eccfa 100644 --- a/tests/Magick.NET.Tests/Drawing/DrawableTests.cs +++ b/tests/Magick.NET.Tests/Drawing/DrawableTests.cs @@ -25,10 +25,6 @@ public void Test_Drawables() image.Draw(new DrawableAlpha(0, 0, PaintMethod.Floodfill)); image.Draw(new DrawableArc(0, 0, 10, 10, 45, 90)); - var bezier = new DrawableBezier(coordinates.ToList()); - Assert.Equal(3, bezier.Coordinates.Count()); - image.Draw(bezier); - image.Draw(new DrawableBorderColor(MagickColors.Fuchsia)); image.Draw(new DrawableCircle(0, 0, 50, 50)); image.Draw(new DrawableClipPath("foo")); @@ -178,21 +174,6 @@ public void Test_Drawables_Draw() [Fact] public void Test_Drawables_Exceptions() { - Assert.Throws("coordinates", () => - { - new DrawableBezier(); - }); - - Assert.Throws("coordinates", () => - { - new DrawableBezier(null); - }); - - Assert.Throws("coordinates", () => - { - new DrawableBezier(Array.Empty()); - }); - Assert.Throws("clipPath", () => { new DrawableClipPath(null);