mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-05-27 16:42:03 +00:00
535709c368
- Remove EnterpriseUrl in integration test Helper class, but leave ability to override custom URL (to allow specific use case of targetting regular integration tests at a custom URL) - Move GitHub Enterprise explicit support to a new integration helper class using new OCTOKIT_GHE_ environment variables for GHE - Change existing GitHub Enterprise integration tests and EnterpriseTestAttribute to use the new EnterpriseHelper methods - Enhance configure-intergration-tests.ps1 script to cater for environment variable changes
34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
using Xunit.Sdk;
|
|
|
|
namespace Octokit.Tests.Integration
|
|
{
|
|
public class GitHubEnterpriseTestDiscoverer : IXunitTestCaseDiscoverer
|
|
{
|
|
readonly IMessageSink diagnosticMessageSink;
|
|
|
|
public GitHubEnterpriseTestDiscoverer(IMessageSink diagnosticMessageSink)
|
|
{
|
|
this.diagnosticMessageSink = diagnosticMessageSink;
|
|
}
|
|
|
|
public IEnumerable<IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
|
|
{
|
|
if (Helper.Credentials == null)
|
|
return Enumerable.Empty<IXunitTestCase>();
|
|
|
|
if (!EnterpriseHelper.IsGitHubEnterpriseEnabled)
|
|
return Enumerable.Empty<IXunitTestCase>();
|
|
|
|
return new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod) };
|
|
}
|
|
}
|
|
|
|
[XunitTestCaseDiscoverer("Octokit.Tests.Integration.GitHubEnterpriseTestDiscoverer", "Octokit.Tests.Integration")]
|
|
public class GitHubEnterpriseTestAttribute : FactAttribute
|
|
{
|
|
}
|
|
} |