using System; using Framework.Geometry.Lines; using UnityEngine; using NUnit.Framework; namespace Framework.Geometry.Lines { /// Unit tests for the 2D line segment class [TestFixture] internal static class Segment2Test { /// /// Verifies that the scalar value constructor assigns the line's coordinates /// [Test] public static void IndividualConstructorAssignsValues() { var segment = new Segment2(1.2f, 3.4f, 5.6f, 7.8f); Assert.That(segment.From.x, Is.EqualTo(1.2f)); Assert.That(segment.From.y, Is.EqualTo(3.4f)); Assert.That(segment.To.x, Is.EqualTo(5.6f)); Assert.That(segment.To.y, Is.EqualTo(7.8f)); } /// /// Verifies that the scalar value constructor assigns the line's coordinates /// [Test] public static void VectorConstructorAssignsValues() { var from = new Vector2(1.2f, 3.4f); var to = new Vector2(5.6f, 7.8f); var segment = new Segment2(from, to); Assert.That(segment.From.x, Is.EqualTo(from.x)); Assert.That(segment.From.y, Is.EqualTo(from.y)); Assert.That(segment.To.x, Is.EqualTo(to.x)); Assert.That(segment.To.y, Is.EqualTo(to.y)); } } } // namespace Framework.Geometry.Lines