Fix FlakyAttribute (dotnet/extensions#2245)
\n\nCommit migrated from 1983ee879c
This commit is contained in:
parent
72dc1409d6
commit
4643c8f350
|
|
@ -4,6 +4,7 @@
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
using Xunit.Sdk;
|
using Xunit.Sdk;
|
||||||
|
|
||||||
|
// Do not change this namespace without changing the usage in ConditionalFactAttribute
|
||||||
namespace Microsoft.AspNetCore.Testing
|
namespace Microsoft.AspNetCore.Testing
|
||||||
{
|
{
|
||||||
internal class ConditionalFactDiscoverer : FactDiscoverer
|
internal class ConditionalFactDiscoverer : FactDiscoverer
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
using Xunit.Sdk;
|
using Xunit.Sdk;
|
||||||
|
|
||||||
|
// Do not change this namespace without changing the usage in ConditionalTheoryAttribute
|
||||||
namespace Microsoft.AspNetCore.Testing
|
namespace Microsoft.AspNetCore.Testing
|
||||||
{
|
{
|
||||||
internal class ConditionalTheoryDiscoverer : TheoryDiscoverer
|
internal class ConditionalTheoryDiscoverer : TheoryDiscoverer
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
/// to <c>xunit.console.exe</c>. Similarly, it can run only flaky tests using <c>-trait "Flaky:AzP:OS:all=true" -trait "Flaky:AzP:OS:Darwin=true"</c>
|
/// to <c>xunit.console.exe</c>. Similarly, it can run only flaky tests using <c>-trait "Flaky:AzP:OS:all=true" -trait "Flaky:AzP:OS:Darwin=true"</c>
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </example>
|
/// </example>
|
||||||
[TraitDiscoverer("Microsoft.AspNetCore.Testing.xunit.FlakyTestDiscoverer", "Microsoft.AspNetCore.Testing")]
|
[TraitDiscoverer("Microsoft.AspNetCore.Testing." + nameof(FlakyTestDiscoverer), "Microsoft.AspNetCore.Testing")]
|
||||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)]
|
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)]
|
||||||
public sealed class FlakyAttribute : Attribute, ITraitAttribute
|
public sealed class FlakyAttribute : Attribute, ITraitAttribute
|
||||||
{
|
{
|
||||||
|
|
@ -72,12 +72,12 @@ namespace Microsoft.AspNetCore.Testing
|
||||||
/// <param name="additionalFilters">A list of additional filters that define where this test is flaky. Use values in <see cref="FlakyOn"/>.</param>
|
/// <param name="additionalFilters">A list of additional filters that define where this test is flaky. Use values in <see cref="FlakyOn"/>.</param>
|
||||||
public FlakyAttribute(string gitHubIssueUrl, string firstFilter, params string[] additionalFilters)
|
public FlakyAttribute(string gitHubIssueUrl, string firstFilter, params string[] additionalFilters)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrEmpty(gitHubIssueUrl))
|
if (string.IsNullOrEmpty(gitHubIssueUrl))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(gitHubIssueUrl));
|
throw new ArgumentNullException(nameof(gitHubIssueUrl));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(string.IsNullOrEmpty(firstFilter))
|
if (string.IsNullOrEmpty(firstFilter))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(firstFilter));
|
throw new ArgumentNullException(nameof(firstFilter));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
using Xunit.Sdk;
|
using Xunit.Sdk;
|
||||||
|
|
||||||
|
// Do not change this namespace without changing the usage in FlakyAttribute
|
||||||
namespace Microsoft.AspNetCore.Testing
|
namespace Microsoft.AspNetCore.Testing
|
||||||
{
|
{
|
||||||
public class FlakyTestDiscoverer : ITraitDiscoverer
|
public class FlakyTestDiscoverer : ITraitDiscoverer
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue