本文整理汇总了C#中ITestFrameworkDiscoveryOptions类的典型用法代码示例。如果您正苦于以下问题:C# ITestFrameworkDiscoveryOptions类的具体用法?C# ITestFrameworkDiscoveryOptions怎么用?C# ITestFrameworkDiscoveryOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITestFrameworkDiscoveryOptions类属于命名空间,在下文中一共展示了ITestFrameworkDiscoveryOptions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Discover
public IEnumerable<IXunitTestCase> Discover(
ITestFrameworkDiscoveryOptions discoveryOptions,
ITestMethod testMethod,
IAttributeInfo factAttribute)
{
var skipReason = EvaluateSkipConditions(testMethod);
var isTheory = false;
IXunitTestCaseDiscoverer innerDiscoverer;
if (testMethod.Method.GetCustomAttributes(typeof(TheoryAttribute)).Any())
{
isTheory = true;
innerDiscoverer = new TheoryDiscoverer(_diagnosticMessageSink);
}
else
{
innerDiscoverer = new FactDiscoverer(_diagnosticMessageSink);
}
var testCases = innerDiscoverer
.Discover(discoveryOptions, testMethod, factAttribute)
.Select(testCase => new SkipReasonTestCase(isTheory, skipReason, testCase));
return testCases;
}
开发者ID:krwq,项目名称:Testing,代码行数:25,代码来源:ConditionalAttributeDiscoverer.cs
示例2: Find
/// <summary>
/// Starts the process of finding all tests in an assembly.
/// </summary>
/// <param name="discoverer">The discoverer.</param>
/// <param name="includeSourceInformation">Whether to include source file information, if possible.</param>
/// <param name="discoveryMessageSink">The message sink to report results back to.</param>
/// <param name="discoveryOptions">The options used by the test framework during discovery.</param>
public static void Find(this ITestFrameworkDiscoverer discoverer,
bool includeSourceInformation,
IMessageSinkWithTypes discoveryMessageSink,
ITestFrameworkDiscoveryOptions discoveryOptions)
{
discoverer.Find(includeSourceInformation, MessageSinkAdapter.Wrap(discoveryMessageSink), discoveryOptions);
}
开发者ID:commonsensesoftware,项目名称:xunit,代码行数:14,代码来源:TestFrameworkExtensions.cs
示例3: Discover
public IEnumerable<IXunitTestCase> Discover (ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
{
var defaultMethodDisplay = discoveryOptions.MethodDisplayOrDefault ();
if (testMethod.Method.GetParameters ().Any ()) {
return new IXunitTestCase[] {
new ExecutionErrorTestCase (messageSink, defaultMethodDisplay, testMethod, "[VsixFact] methods are not allowed to have parameters.")
};
} else {
var vsVersions = VsVersions.GetFinalVersions(testMethod.GetComputedProperty<string[]>(factAttribute, SpecialNames.VsixAttribute.VisualStudioVersions));
// Process VS-specific traits.
var suffix = testMethod.GetComputedArgument<string>(factAttribute, SpecialNames.VsixAttribute.RootSuffix) ?? "Exp";
var newInstance = testMethod.GetComputedArgument<bool?>(factAttribute, SpecialNames.VsixAttribute.NewIdeInstance);
var timeout = testMethod.GetComputedArgument<int?>(factAttribute, SpecialNames.VsixAttribute.TimeoutSeconds).GetValueOrDefault(XunitExtensions.DefaultTimeout);
var testCases = new List<IXunitTestCase>();
// Add invalid VS versions.
testCases.AddRange (vsVersions
.Where (v => !VsVersions.InstalledVersions.Contains (v))
.Select (v => new ExecutionErrorTestCase (messageSink, defaultMethodDisplay, testMethod,
string.Format ("Cannot execute test for specified {0}={1} because there is no VSSDK installed for that version.", SpecialNames.VsixAttribute.VisualStudioVersions, v))));
testCases.AddRange (vsVersions
.Where (v => VsVersions.InstalledVersions.Contains (v))
.Select (v => new VsixTestCase (messageSink, defaultMethodDisplay, testMethod, v, suffix, newInstance, timeout)));
return testCases;
}
}
开发者ID:victorgarciaaprea,项目名称:xunit.vsix,代码行数:29,代码来源:VsixFactDiscoverer.cs
示例4:
public IEnumerable<IXunitTestCase> Discover
( ITestFrameworkDiscoveryOptions discoveryOptions
, ITestMethod testMethod
, IAttributeInfo factAttribute
)
{
var inv = InvariantTestCase.InvariantFromMethod(testMethod);
return
inv == null
? new[]
{ new InvariantTestCase
( MessageSink
, TestMethodDisplay.Method
, testMethod
, null
)
}
: inv.AsSeq().Select
( i =>
new InvariantTestCase
( MessageSink
, TestMethodDisplay.Method
, testMethod
, i
)
);
}
开发者ID:sharper-library,项目名称:Sharper.C.Testing,代码行数:27,代码来源:InvariantDiscoverer.cs
示例5: Discover
public IEnumerable<IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
{
var defaultMethodDisplay = discoveryOptions.MethodDisplayOrDefault();
return factAttribute.GetNamedArgument<string>("Skip") != null
? new[] { new XunitTestCase(_diagnosticMessageSink, defaultMethodDisplay, testMethod) }
: new XunitTestCase[] { new ScenarioTestCase(_diagnosticMessageSink, defaultMethodDisplay, testMethod) };
}
开发者ID:surgeforward,项目名称:LightBDD,代码行数:7,代码来源:ScenarioTestCaseDiscoverer.cs
示例6: FindTestsForMethod
/// <summary>
/// Finds the tests on a test method.
/// </summary>
/// <param name="testMethod">The test method.</param>
/// <param name="includeSourceInformation">Set to <c>true</c> to indicate that source information should be included.</param>
/// <param name="messageBus">The message bus to report discovery messages to.</param>
/// <param name="discoveryOptions">The options used by the test framework during discovery.</param>
/// <returns>Return <c>true</c> to continue test discovery, <c>false</c>, otherwise.</returns>
protected virtual bool FindTestsForMethod(ITestMethod testMethod, bool includeSourceInformation, IMessageBus messageBus, ITestFrameworkDiscoveryOptions discoveryOptions)
{
var factAttributes = testMethod.Method.GetCustomAttributes(typeof(FactAttribute)).CastOrToList();
if (factAttributes.Count > 1)
{
var message = string.Format("Test method '{0}.{1}' has multiple [Fact]-derived attributes", testMethod.TestClass.Class.Name, testMethod.Method.Name);
var testCase = new ExecutionErrorTestCase(DiagnosticMessageSink, TestMethodDisplay.ClassAndMethod, testMethod, message);
return ReportDiscoveredTestCase(testCase, includeSourceInformation, messageBus);
}
var factAttribute = factAttributes.FirstOrDefault();
if (factAttribute == null)
return true;
var testCaseDiscovererAttribute = factAttribute.GetCustomAttributes(typeof(XunitTestCaseDiscovererAttribute)).FirstOrDefault();
if (testCaseDiscovererAttribute == null)
return true;
var args = testCaseDiscovererAttribute.GetConstructorArguments().Cast<string>().ToList();
var discovererType = SerializationHelper.GetType(args[1], args[0]);
if (discovererType == null)
return true;
var discoverer = GetDiscoverer(discovererType);
if (discoverer == null)
return true;
foreach (var testCase in discoverer.Discover(discoveryOptions, testMethod, factAttribute))
if (!ReportDiscoveredTestCase(testCase, includeSourceInformation, messageBus))
return false;
return true;
}
开发者ID:ricardoshimoda,项目名称:xunit,代码行数:41,代码来源:XunitTestFrameworkDiscoverer.cs
示例7: Discover
public override IEnumerable<IXunitTestCase> Discover(
ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
{
string[] conditionMemberNames = factAttribute.GetConstructorArguments().FirstOrDefault() as string[];
IEnumerable<IXunitTestCase> testCases = base.Discover(discoveryOptions, testMethod, factAttribute);
return ConditionalTestDiscoverer.Discover(discoveryOptions, _diagnosticMessageSink, testMethod, testCases, conditionMemberNames);
}
开发者ID:dsgouda,项目名称:buildtools,代码行数:7,代码来源:ConditionalFactDiscoverer.cs
示例8: Discover
public virtual IEnumerable<IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
{
var variations = testMethod.Method
.GetCustomAttributes(typeof(BenchmarkVariationAttribute))
.ToDictionary(
a => a.GetNamedArgument<string>(nameof(BenchmarkVariationAttribute.VariationName)),
a => a.GetNamedArgument<object[]>(nameof(BenchmarkVariationAttribute.Data)));
if (!variations.Any())
{
variations.Add("Default", new object[0]);
}
var tests = new List<IXunitTestCase>();
foreach (var variation in variations)
{
tests.Add(new BenchmarkTestCase(
factAttribute.GetNamedArgument<int>(nameof(BenchmarkAttribute.Iterations)),
factAttribute.GetNamedArgument<int>(nameof(BenchmarkAttribute.WarmupIterations)),
variation.Key,
_diagnosticMessageSink,
testMethod,
variation.Value));
}
return tests;
}
开发者ID:tuespetre,项目名称:mvc-sandbox,代码行数:27,代码来源:BenchmarkTestDiscoverer.cs
示例9: RunAll
/// <summary>
/// Starts the process of running all the tests in the assembly.
/// </summary>
/// <param name="executor">The executor.</param>
/// <param name="executionMessageSink">The message sink to report results back to.</param>
/// <param name="discoveryOptions">The options to be used during test discovery.</param>
/// <param name="executionOptions">The options to be used during test execution.</param>
public static void RunAll(this ITestFrameworkExecutor executor,
IMessageSinkWithTypes executionMessageSink,
ITestFrameworkDiscoveryOptions discoveryOptions,
ITestFrameworkExecutionOptions executionOptions)
{
executor.RunAll(MessageSinkAdapter.Wrap(executionMessageSink), discoveryOptions, executionOptions);
}
开发者ID:commonsensesoftware,项目名称:xunit,代码行数:14,代码来源:TestFrameworkExtensions.cs
示例10: Discover
public override IEnumerable<IXunitTestCase> Discover(
ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
{
MethodInfo testMethodInfo = testMethod.Method.ToRuntimeMethod();
string conditionMemberName = factAttribute.GetConstructorArguments().FirstOrDefault() as string;
MethodInfo conditionMethodInfo;
if (conditionMemberName == null ||
(conditionMethodInfo = LookupConditionalMethod(testMethodInfo.DeclaringType, conditionMemberName)) == null)
{
return new[] {
new ExecutionErrorTestCase(
_diagnosticMessageSink,
discoveryOptions.MethodDisplayOrDefault(),
testMethod,
GetFailedLookupString(conditionMemberName))
};
}
IEnumerable<IXunitTestCase> testCases = base.Discover(discoveryOptions, testMethod, factAttribute);
if ((bool)conditionMethodInfo.Invoke(null, null))
{
return testCases;
}
else
{
string skippedReason = "\"" + conditionMemberName + "\" returned false.";
return testCases.Select(tc => new SkippedTestCase(tc, skippedReason));
}
}
开发者ID:jango2015,项目名称:buildtools,代码行数:30,代码来源:ConditionalFactDiscoverer.cs
示例11: FindTestsForMethod
/// <summary>
/// Finds the tests on a test method.
/// </summary>
/// <param name="testMethod">The test method.</param>
/// <param name="includeSourceInformation">Set to <c>true</c> to indicate that source information should be included.</param>
/// <param name="messageBus">The message bus to report discovery messages to.</param>
/// <param name="discoveryOptions">The options used by the test framework during discovery.</param>
/// <returns>Return <c>true</c> to continue test discovery, <c>false</c>, otherwise.</returns>
protected virtual bool FindTestsForMethod(ITestMethod testMethod, bool includeSourceInformation, IMessageBus messageBus, ITestFrameworkDiscoveryOptions discoveryOptions)
{
var factAttribute = testMethod.Method.GetCustomAttributes(typeof(FactAttribute)).FirstOrDefault();
if (factAttribute == null)
return true;
var testCaseDiscovererAttribute = factAttribute.GetCustomAttributes(typeof(XunitTestCaseDiscovererAttribute)).FirstOrDefault();
if (testCaseDiscovererAttribute == null)
return true;
var args = testCaseDiscovererAttribute.GetConstructorArguments().Cast<string>().ToList();
var discovererType = SerializationHelper.GetType(args[1], args[0]);
if (discovererType == null)
return true;
var discoverer = GetDiscoverer(discovererType);
if (discoverer == null)
return true;
foreach (var testCase in discoverer.Discover(discoveryOptions, testMethod, factAttribute))
if (!ReportDiscoveredTestCase(testCase, includeSourceInformation, messageBus))
return false;
return true;
}
开发者ID:remcomulder,项目名称:xunit,代码行数:33,代码来源:XunitTestFrameworkDiscoverer.cs
示例12: TestAssemblyDiscoveryStarting
/// <summary>
/// Initializes a new instance of the <see cref="TestAssemblyDiscoveryStarting"/> class.
/// </summary>
/// <param name="assembly">Information about the assembly that is being discovered</param>
/// <param name="discoveryOptions">The discovery options</param>
/// <param name="executionOptions">The execution options</param>
public TestAssemblyDiscoveryStarting(XunitProjectAssembly assembly,
ITestFrameworkDiscoveryOptions discoveryOptions,
ITestFrameworkExecutionOptions executionOptions)
{
Assembly = assembly;
DiscoveryOptions = discoveryOptions;
ExecutionOptions = executionOptions;
}
开发者ID:ricardoshimoda,项目名称:xunit,代码行数:14,代码来源:TestAssemblyDiscoveryStarting.cs
示例13: Discover
public IEnumerable<IXunitTestCase> Discover(
ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
{
Guard.AgainstNullArgument("discoveryOptions", discoveryOptions);
yield return new ScenarioOutline(
this.diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod);
}
开发者ID:mvalipour,项目名称:xbehave.dnx.test,代码行数:8,代码来源:ScenarioDiscoverer.cs
示例14: SkipMethod
protected override bool SkipMethod(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
{
var classOfMethod = Type.GetType(testMethod.TestClass.Class.Name, true, true);
//in mixed mode we do not want to run any api tests for plugins when running against a snapshot
//because the client is "hot"
var collectionType = TestAssemblyRunner.GetClusterForCollection(testMethod.TestClass?.TestCollection);
return TestClient.Configuration.RunIntegrationTests && RequiresPluginButRunningAgainstSnapshot(classOfMethod, collectionType);
}
开发者ID:niemyjski,项目名称:elasticsearch-net,代码行数:8,代码来源:UnitTestDiscoverer.cs
示例15: CreateTestCase
protected override IXunitTestCase CreateTestCase(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute) {
if (testMethod.Method.ReturnType.Name == "System.Void" &&
testMethod.Method.GetCustomAttributes(typeof(AsyncStateMachineAttribute)).Any()) {
return new ExecutionErrorTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod, "Async void methods are not supported.");
}
return new LegacyUITestCase(UITestCase.SyncContextType.WPF, diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod);
}
开发者ID:Xarlot,项目名称:Xunit.StaFact,代码行数:8,代码来源:LegacyStaFactDiscoverer.cs
示例16: TestAssemblyDiscoveryStarting
/// <summary>
/// Initializes a new instance of the <see cref="TestAssemblyDiscoveryStarting"/> class.
/// </summary>
/// <param name="assembly">Information about the assembly that is being discovered</param>
/// <param name="appDomain">Indicates whether the tests will be discovered and run in a separate app domain</param>
/// <param name="discoveryOptions">The discovery options</param>
public TestAssemblyDiscoveryStarting(XunitProjectAssembly assembly,
bool appDomain,
ITestFrameworkDiscoveryOptions discoveryOptions)
{
Assembly = assembly;
AppDomain = appDomain;
DiscoveryOptions = discoveryOptions;
}
开发者ID:antonfirsov,项目名称:xunit,代码行数:14,代码来源:TestAssemblyDiscoveryStarting.cs
示例17: Discover
public IEnumerable<IXunitTestCase> Discover(
ITestFrameworkDiscoveryOptions discoveryOptions,
ITestMethod testMethod,
IAttributeInfo factAttribute
)
{
yield return new FarmDependentTestCase(_diagnosticSink, discoveryOptions.MethodDisplayOrDefault(), testMethod);
}
开发者ID:NaseUkolyCZ,项目名称:HarshPoint,代码行数:8,代码来源:FarmDependentTestCaseDiscoverer.cs
示例18: Discover
public IEnumerable<IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
{
var maxRetries = factAttribute.GetNamedArgument<int>("MaxRetries");
if (maxRetries < 1)
maxRetries = 3;
yield return new RetryTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod, maxRetries);
}
开发者ID:chris134pravin,项目名称:VisualStudio,代码行数:8,代码来源:RetryFactDiscoverer.cs
示例19: Discover
/// <summary>
/// Discover test cases from a test method. By default, inspects the test method's argument list
/// to ensure it's empty, and if not, returns a single <see cref="ExecutionErrorTestCase"/>;
/// otherwise, it returns the result of calling <see cref="CreateTestCase"/>.
/// </summary>
/// <param name="discoveryOptions">The discovery options to be used.</param>
/// <param name="testMethod">The test method the test cases belong to.</param>
/// <param name="factAttribute">The fact attribute attached to the test method.</param>
/// <returns>Returns zero or more test cases represented by the test method.</returns>
public virtual IEnumerable<IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
{
var testCase =
testMethod.Method.GetParameters().Any()
? new ExecutionErrorTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod, "[Fact] methods are not allowed to have parameters. Did you mean to use [Theory]?")
: CreateTestCase(discoveryOptions, testMethod, factAttribute);
return new[] { testCase };
}
开发者ID:modai888,项目名称:xunit,代码行数:18,代码来源:FactDiscoverer.cs
示例20: Discover
public IEnumerable<IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
{
if (Helper.Organization == null)
{
return Enumerable.Empty<IXunitTestCase>();
}
return new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod) };
}
开发者ID:cloudRoutine,项目名称:octokit.net,代码行数:9,代码来源:BasicAuthenticationTestAttribute.cs
注:本文中的ITestFrameworkDiscoveryOptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论