using System.Collections.Generic; using System.Linq; using Chernobyl.Mathematics.Movement; using NUnit.Framework; namespace Chernobyl.Mathematics.Geometry { [TestFixture, Description("Tests for the ArcExtensions type.")] public class ArcExtensionsTests { [Test, Description("A test to ensure that ArcExtensions.ToLineSegments(IArc arc) " + "returns one ILineSegment instance when two ITransform instances are " + "in the passed in IArc.")] public void ToLineSegmentTwoTransforms() { ITransform[] points = new ITransform[] { new MatrixTransform(), new MatrixTransform() }; IArc arc = new Arc(points); IEnumerable lineSegments = arc.ToLineSegments(); Assert.AreEqual(1, lineSegments.Count(), "Unexpected number of " + "ILineSegment instances in the returned IEnumerable{T}."); } [Test, Description("A test to ensure that ArcExtensions.ToLineSegments(IArc arc) " + "returns three ILineSegment instance when four ITransform instances are " + "in the passed in IArc.")] public void ToLineSegmentFourTransforms() { ITransform[] points = new ITransform[] { new MatrixTransform(), new MatrixTransform(), new MatrixTransform(), new MatrixTransform() }; IArc arc = new Arc(points); IEnumerable lineSegments = arc.ToLineSegments(); Assert.AreEqual(3, lineSegments.Count(), "Unexpected number of " + "ILineSegment instances in the returned IEnumerable{T}."); } } }