Exemplo n.º 1
0
        private IEnumerable <IXunitTestCase> DiscoverRazorTests(Type testComponent, ITestMethod testMethod)
        {
            DiagnosticMessageSink.OnMessage(new DiagnosticMessage($"{nameof(DiscoverRazorTests)}: Discovering in {testComponent.FullName}."));

            using var razorRenderer = new TestComponentRenderer();
            var tests = razorRenderer.GetRazorTestsFromComponent(testComponent);

            var result = tests.Count == 0
                                ? Array.Empty <IXunitTestCase>()
                                : new IXunitTestCase[tests.Count];

            for (int index = 0; index < tests.Count; index++)
            {
                var test       = tests[index];
                var testNumber = index + 1;
                var sourceInfo = _sourceInfoDiscoverer.GetSourceInformation(testComponent, test, testNumber);
                result[index] = new RazorTestCase(GetDisplayName(test, testNumber), test.Timeout, test.Skip, testNumber, testMethod, sourceInfo);
            }

            return(result);
        }
Exemplo n.º 2
0
 public RazorTest(RazorTestCase testCase, string displayName) : base(testCase, displayName)
 {
     TestNumber = testCase.TestNumber;
 }
Exemplo n.º 3
0
 public RazorTestCaseRunner(RazorTestCase testCase, string displayName, string?skipReason, object[] constructorArguments, object[] testMethodArguments, IMessageBus messageBus, ExceptionAggregator aggregator, CancellationTokenSource cancellationTokenSource)
     : base(testCase, displayName, skipReason, constructorArguments, testMethodArguments, messageBus, aggregator, cancellationTokenSource)
 {
     _razorTestCase = testCase;
 }