/// <summary> /// Runs a specific test runner on a method. The test runner is deduced from the specified /// argument <paramref name="attributeType"/> . The <see cref="Type"/> of <paramref name="attributeType"/> /// must be a subclass of <see cref="MoyaAttribute"/>. It must also have a mapping to a test runner /// which either explicitly or implicitly implement <see cref="IMoyaTestRunner"/>. /// </summary> /// <param name="methodInfo">A method we want to test.</param> /// <param name="attributeType">A </param> private void RunTest(MethodInfo methodInfo, Type attributeType) { if (!MethodHasAttribute(methodInfo, attributeType)) { return; } IMoyaTestRunner testRunner = _testRunnerFactory.GetTestRunnerForAttribute(attributeType); IMoyaTestRunner decoratedTestRunner = _testRunnerDecorator.DecorateTestRunner(testRunner); _testResults.Add(decoratedTestRunner.Execute(methodInfo)); }
/// <summary> /// Runs one or more user made test runners. /// </summary> /// <param name="testRunners">The test runner(s) to run.</param> /// <param name="methodInfo">The targeted <see cref="MethodInfo"/> which will be run by the test runners.</param> private void RunCustomTestRunners(IEnumerable <IMoyaTestRunner> testRunners, MethodInfo methodInfo) { foreach (var testRunner in testRunners) { var attributeType = _testRunnerFactory.GetAttributeForTestRunner(testRunner.GetType()); if (MethodHasAttribute(methodInfo, attributeType.GetType())) { IMoyaTestRunner decoratedTestRunner = _testRunnerDecorator.DecorateTestRunner(testRunner); _testResults.Add(decoratedTestRunner.Execute(methodInfo)); } } }