private void reflectAllUnitTests(Quaternion_Tests myTestObject) { //retrieve all the test method names in this test class using .NET reflection //note that this is only getting the public members MethodInfo[] methodInfos = typeof(Quaternion_Tests).GetMethods(); //call all the tests in this test class again foreach (MethodInfo methodInfo in methodInfos) { if (methodInfo.Name.Contains("Check")) { Debug.Log("------Running Test [" + methodInfo.Name + "]------"); methodInfo.Invoke(myTestObject, null); } } }
public void _checkYawAxisOnly() { //I know this probably seems confusing but... //Since we are using recursion, we need to make sure we *DO NOT* repeat this test if we are //within a sub=obejct of the parent unit test. Therefore, if all the flags are not set to true // then it must mean that we are inside a created sub-object unit test and // there is no need to re-run th tests again if (_checkPitch && _checkRoll && _checkPitch) // this means we are in the parent unit test { //arrange Quaternion_Tests myTestObject = new Quaternion_Tests(); myTestObject._checkPitch = false; myTestObject._checkRoll = false; myTestObject._checkYaw = true; reflectAllUnitTests(myTestObject); } }