コード例 #1
0
        private async Task <decimal> RunRepeatTestInvoker(ExceptionAggregator aggregator, ITestOutputHelper output, bool collectDump, RepeatAttribute repeatAttribute)
        {
            var repeatContext = new RepeatContext
            {
                Limit = repeatAttribute.RunCount
            };

            var timeTaken  = 0.0M;
            var testLogger = new LoggedTestInvoker(
                Test,
                MessageBus,
                TestClass,
                ConstructorArguments,
                TestMethod,
                TestMethodArguments,
                BeforeAfterAttributes,
                aggregator,
                CancellationTokenSource,
                output,
                repeatContext,
                collectDump);

            for (repeatContext.CurrentIteration = 0; repeatContext.CurrentIteration < repeatContext.Limit; repeatContext.CurrentIteration++)
            {
                timeTaken = await testLogger.RunAsync();

                if (aggregator.HasExceptions)
                {
                    return(timeTaken);
                }
            }

            return(timeTaken);
        }
コード例 #2
0
 public LoggedTestInvoker(
     ITest test,
     IMessageBus messageBus,
     Type testClass,
     object[] constructorArguments,
     MethodInfo testMethod,
     object[] testMethodArguments,
     IReadOnlyList <BeforeAfterTestAttribute> beforeAfterAttributes,
     ExceptionAggregator aggregator,
     CancellationTokenSource cancellationTokenSource,
     ITestOutputHelper output,
     RepeatContext repeatContext,
     bool collectDumpOnFailure)
     : base(test, messageBus, testClass, constructorArguments, testMethod, testMethodArguments, beforeAfterAttributes, aggregator, cancellationTokenSource)
 {
     _output               = output;
     _repeatContext        = repeatContext;
     _collectDumpOnFailure = collectDumpOnFailure;
 }