mirror of https://github.com/dotnet/tye.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.8 KiB
49 lines
1.8 KiB
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Reflection;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Xunit.Abstractions;
|
|
using Xunit.Sdk;
|
|
|
|
namespace Microsoft.AspNetCore.Testing
|
|
{
|
|
internal class AspNetTestRunner : XunitTestRunner
|
|
{
|
|
public AspNetTestRunner(
|
|
ITest test,
|
|
IMessageBus messageBus,
|
|
Type testClass,
|
|
object[] constructorArguments,
|
|
MethodInfo testMethod,
|
|
object[] testMethodArguments,
|
|
string skipReason,
|
|
IReadOnlyList<BeforeAfterTestAttribute> beforeAfterAttributes,
|
|
ExceptionAggregator aggregator,
|
|
CancellationTokenSource cancellationTokenSource)
|
|
: base(test, messageBus, testClass, constructorArguments, testMethod, testMethodArguments, skipReason, beforeAfterAttributes, aggregator, cancellationTokenSource)
|
|
{
|
|
}
|
|
|
|
protected override async Task<decimal> InvokeTestMethodAsync(ExceptionAggregator aggregator)
|
|
{
|
|
var timeTaken = 0.0M;
|
|
timeTaken = await InvokeTestMethodCoreAsync(aggregator);
|
|
if (aggregator.HasExceptions)
|
|
{
|
|
return timeTaken;
|
|
}
|
|
|
|
return timeTaken;
|
|
}
|
|
|
|
private Task<decimal> InvokeTestMethodCoreAsync(ExceptionAggregator aggregator)
|
|
{
|
|
var invoker = new AspNetTestInvoker(Test, MessageBus, TestClass, ConstructorArguments, TestMethod, TestMethodArguments, BeforeAfterAttributes, aggregator, CancellationTokenSource);
|
|
return invoker.RunAsync();
|
|
}
|
|
}
|
|
}
|
|
|