예제 #1
0
        /// <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));
        }
예제 #2
0
        public void DecoratingAddsTimerDecorator()
        {
            IMoyaTestRunner decoratedTestRunner = _moyaTestRunnerDecorator.DecorateTestRunner(_mockTestRunner.Object);

            Assert.Equal(typeof(TimerDecorator), decoratedTestRunner.GetType());
        }