diff --git a/Octokit.Tests.Integration/Helpers/BasicAuthenticationTestAttribute.cs b/Octokit.Tests.Integration/Helpers/BasicAuthenticationTestAttribute.cs new file mode 100644 index 00000000..e1ced818 --- /dev/null +++ b/Octokit.Tests.Integration/Helpers/BasicAuthenticationTestAttribute.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.Linq; +using Xunit; +using Xunit.Abstractions; +using Xunit.Sdk; + +namespace Octokit.Tests.Integration +{ + public class BasicAuthenticationTestDiscoverer : IXunitTestCaseDiscoverer + { + readonly IMessageSink diagnosticMessageSink; + + public BasicAuthenticationTestDiscoverer(IMessageSink diagnosticMessageSink) + { + this.diagnosticMessageSink = diagnosticMessageSink; + } + + public IEnumerable Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute) + { + if (Helper.Organization == null) + { + return Enumerable.Empty(); + } + + return new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod) }; + } + } + + [XunitTestCaseDiscoverer("Octokit.Tests.Integration.BasicAuthenticationTestDiscoverer", "Octokit.Tests.Integration")] + public class BasicAuthenticationTestAttribute : FactAttribute + { + } +} diff --git a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj index f4697936..cecb4fd2 100644 --- a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj +++ b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj @@ -105,6 +105,7 @@ +