using System.Collections.Generic; using Chernobyl.Mathematics.Vectors; using NUnit.Framework; namespace Chernobyl.Mathematics.Movement { [TestFixture, Description("A set of tests for verifying that the " + "MatrixTransform works as expected.")] public class MatrixTransformTests : TransformTests { [Test, Description("Tests the MatrixTransform.MatrixTransform() " + "constructor to ensure it sets the proper ITransform.LocalMatrix " + "value.")] public void DefaultConstructorTest() { MatrixTransform transform = new MatrixTransform(); Assert.AreEqual(Matrix4.Identity, transform.LocalMatrix, "ITransform.LocalMatrix was not set to the expected value."); } [Test, Description("Tests the MatrixTransform.MatrixTransform(ref Matrix4) " + "constructor to ensure it sets the proper ITransform.LocalMatrix value.")] public void ConstructorMatrix4Test() { Matrix4 matrix = new Matrix4(Vector4.UnitZ, Vector4.UnitX, Vector4.UnitW, Vector4.UnitX); MatrixTransform transform = new MatrixTransform(ref matrix); Assert.AreEqual(matrix, transform.LocalMatrix, "ITransform.LocalMatrix was not set to the expected value."); } [Test, Description("Tests the MatrixTransform.MatrixTransform(IList) " + "constructor to ensure it sets the proper ITransform.TransformChildren " + "value.")] public void ConstructorIListTest() { IList children = new List(new[] {new MatrixTransform()}); MatrixTransform transform = new MatrixTransform(children); Assert.AreEqual(children, transform.TransformChildren, "ITransform.TransformChildren was not set to the expected value."); } [Test, Description("Tests the MatrixTransform.MatrixTransform(ref Matrix4, IList) " + "constructor to ensure it sets the proper ITransform.LocalMatrix and " + "ITransform.TransformChildren values.")] public void ConstructorMatrix4IListTest() { Matrix4 matrix = new Matrix4(Vector4.UnitZ, Vector4.UnitX, Vector4.UnitW, Vector4.UnitX); IList children = new List(new[] { new MatrixTransform() }); MatrixTransform transform = new MatrixTransform(ref matrix, children); Assert.AreEqual(matrix, transform.LocalMatrix, "ITransform.LocalMatrix was not set to the expected value."); Assert.AreEqual(children, transform.TransformChildren, "ITransform.TransformChildren was not set to the expected value."); } protected override ITransform CreateTransform() { return new MatrixTransform(); } } }