コード例 #1
0
        bool FindTestsForMethod(ITestMethod testMethod,
                                TestMethodDisplay defaultMethodDisplay,
                                bool includeSourceInformation,
                                IMessageBus messageBus)
        {
            var observationAttribute = testMethod.Method.GetCustomAttributes(typeof(FactAttribute)).FirstOrDefault();

            if (observationAttribute == null)
            {
                return(true);
            }

            var testCase = new ObservationTestCase(defaultMethodDisplay, testMethod);

            var skipReason = GetSkipReason(observationAttribute);

            if (!string.IsNullOrWhiteSpace(skipReason))
            {
                var skipTestCase = new SkippedTestCase(defaultMethodDisplay, testMethod);
                skipTestCase.SetSkipReason(skipReason);
                testCase = skipTestCase;
            }

            if (!ReportDiscoveredTestCase(testCase, includeSourceInformation, messageBus))
            {
                return(false);
            }

            return(true);
        }
コード例 #2
0
        bool FindTestsForMethod(ITestMethod testMethod,
                                TestMethodDisplay defaultMethodDisplay,
                                bool includeSourceInformation,
                                IMessageBus messageBus)
        {
            var observationAttribute = testMethod.Method.GetCustomAttributes(typeof(FactAttribute)).FirstOrDefault(); 
            if (observationAttribute == null)
                return true;

            var testCase = new ObservationTestCase(defaultMethodDisplay, testMethod);

            var skipReason = GetSkipReason(observationAttribute);
            if (!string.IsNullOrWhiteSpace(skipReason))
            {
                var skipTestCase = new SkippedTestCase(defaultMethodDisplay, testMethod);
                skipTestCase.SetSkipReason(skipReason);
                testCase = skipTestCase;
            }
            
            if (!ReportDiscoveredTestCase(testCase, includeSourceInformation, messageBus))
                return false;

            return true;
        }