/// Returns the single axis test cases.
/// 1. param: rotation in euler angles
/// 2. param: expected result of xyz-component of quaternion
- /// 3. param: test name (Don't found a working way how to pass this to xUnit runner). I let it here for test documentation
/// </summary>
/// <value>The single axis test cases.</value>
public static IEnumerable<object> SingleAxisTestCases()
{
- yield return new object[] { new Vector3(1, 0, 0), Vector3.UnitX, "Rotate around x axis" };
- yield return new object[] { new Vector3(0, 1, 0), Vector3.UnitY, "Rotate around y axis" };
- yield return new object[] { new Vector3(0, 0, 1), Vector3.UnitZ, "Rotate around z axis" };
+ yield return new object[] { new Vector3(1, 0, 0), Vector3.UnitX}; //"Rotate around x axis"
+ yield return new object[] { new Vector3(0, 1, 0), Vector3.UnitY}; //"Rotate around y axis"
+ yield return new object[] { new Vector3(0, 0, 1), Vector3.UnitZ}; //"Rotate around z axis"
}
/// <summary>
/// Returns the single ToAxisAngle test cases.
/// 1. param: Quaternion which a definied value of xyz-component.
/// 2. param: expected result of xyz-component of quaternion
- /// 3. param: test name (Don't found a working way how to pass this to xUnit runner). I let it here for test documentation
/// </summary>
/// <value>The single axis test cases.</value>
public static IEnumerable<object[]> ToAxisAngleTestCases()
{
- yield return new object[] { new Quaternion(Vector3.UnitX, 0), Vector3.UnitX, "Rotate around x axis" };
- yield return new object[] { new Quaternion(Vector3.UnitY, 0), Vector3.UnitY, "Rotate around y axis" };
- yield return new object[] { new Quaternion(Vector3.UnitZ, 0), Vector3.UnitZ, "Rotate around z axis" };
+ yield return new object[] { new Quaternion(Vector3.UnitX, 0), Vector3.UnitX}; //"Rotate around x axis"
+ yield return new object[] { new Quaternion(Vector3.UnitY, 0), Vector3.UnitY}; //"Rotate around y axis"
+ yield return new object[] { new Quaternion(Vector3.UnitZ, 0), Vector3.UnitZ}; //"Rotate around z axis"
}
}
namespace OpenTK.Tests.Math
{
- public class Quaternion_Tests
+ public class QuaternionTests
{
/// <summary>
- /// Contains all tests which cover the ctor of Quaternion.
+ /// Contains all tests which cover the constructor of Quaternion.
/// </summary>
- public class Constructor_Tests
+ public class Constructor
{
/// <summary>
/// Checks if a single given value (either pitch, yaw or roll) get converted into correct x,y,z value of quaternion.
/// </summary>
/// <param name="eulerValues">euler angle values</param>
/// <param name="expectedResult">expected xyz component of quaternion</param>
- /// <param name="testName">Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works.</param>
[Theory]
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
- public void SingleAxisAsEulerAnglesInFloatsIsConvertedToCorrectValueInQuaternion
- (Vector3 eulerValues, Vector3 expectedResult, string testName)
+ public void SingleAxisAsEulerAnglesInFloatsIsConvertedToCorrectQuaternionComponents
+ (Vector3 eulerValues, Vector3 expectedResult)
{
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
var cut = new Quaternion(eulerValues.X, eulerValues.Y, eulerValues.Z);
/// </summary>
/// <param name="eulerValues">euler angle values</param>
/// <param name="expectedResult">expected xyz component of quaternion</param>
- /// <param name="testName">Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works.</param>
[Theory]
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
- public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectValueInQuaternion
- (Vector3 eulerValues, Vector3 expectedResult, string testName)
+ public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectQuaternionComponents
+ (Vector3 eulerValues, Vector3 expectedResult)
{
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
var cut = new Quaternion(eulerValues);
/// <summary>
/// Contains all tests for FromEulerAngles
/// </summary>
- public class FromEulerAngles_Tests
+ public class FromEulerAngles
{
/// <summary>
/// Checks if a single given value (either pitch, yaw or roll) get converted into correct x,y,z value of quaternion.
/// </summary>
/// <param name="eulerValues">euler angle values</param>
/// <param name="expectedResult">expected xyz component of quaternion</param>
- /// <param name="testName">Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works.</param>
[Theory]
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
- public void SingleAxisAsEulerAnglesInFloatsIsConvertedToCorrectValueInQuaternion
- (Vector3 eulerValues, Vector3 expectedResult, string testName)
+ public void SingleAxisAsEulerAnglesInFloatsIsConvertedToCorrectQuaternionComponents
+ (Vector3 eulerValues, Vector3 expectedResult)
{
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
var cut = Quaternion.FromEulerAngles(eulerValues.X, eulerValues.Y, eulerValues.Z);
/// </summary>
/// <param name="eulerValues">euler angle values</param>
/// <param name="expectedResult">expected xyz component of quaternion</param>
- /// <param name="testName">Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works.</param>
[Theory]
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
- public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectValueInQuaternion
- (Vector3 eulerValues, Vector3 expectedResult, string testName)
+ public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectQuaternionComponents
+ (Vector3 eulerValues, Vector3 expectedResult)
{
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
var cut = Quaternion.FromEulerAngles(eulerValues);
/// </summary>
/// <param name="eulerValues">euler angle values</param>
/// <param name="expectedResult">expected xyz component of quaternion</param>
- /// <param name="testName">Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works.</param>
[Theory]
[MemberData(nameof(QuaternionTestDataGenerator.SingleAxisTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
- public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectValueInQuaternionAsOutParam
- (Vector3 eulerValues, Vector3 expectedResult, string testName)
+ public void SingleAxisAsEulerAnglesInVector3IsConvertedToCorrectQuaternionComponentsAsOutParam
+ (Vector3 eulerValues, Vector3 expectedResult)
{
//Arrange + Act: Create Quaternion with "pitch/yaw/roll"
var cut = Quaternion.Identity;
/// </summary>
/// <param name="cut">Prepared Quaternion</param>
/// <param name="expectedResult">Expected result.</param>
- /// <param name="testName">Taken from nUnit test data. Don't know how to name data driven tests for xUnit which actually works.</param>
[Theory]
[MemberData(nameof(QuaternionTestDataGenerator.ToAxisAngleTestCases), MemberType = typeof(QuaternionTestDataGenerator))]
- public void PreparedSingleRotationAxisQuaternionConvertsToCorrectAxisAngleRepresentation(Quaternion cut, Vector3 expectedResult, string testName)
+ public void PreparedSingleRotationAxisQuaternionConvertsToCorrectAxisAngleRepresentation(Quaternion cut, Vector3 expectedResult)
{
//Arrange + Act: Create Quaternion with rotation about X/Y/Z axis
Vector3 resultXYZ;