mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-05 23:06:10 +00:00
37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
using Xunit.Sdk;
|
|
|
|
namespace Octokit.Tests.Integration
|
|
{
|
|
public class ApplicationTestDiscoverer : IXunitTestCaseDiscoverer
|
|
{
|
|
readonly IMessageSink diagnosticMessageSink;
|
|
|
|
public ApplicationTestDiscoverer(IMessageSink diagnosticMessageSink)
|
|
{
|
|
this.diagnosticMessageSink = diagnosticMessageSink;
|
|
}
|
|
|
|
|
|
public IEnumerable<IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(Helper.ClientId)
|
|
&& string.IsNullOrWhiteSpace(Helper.ClientSecret))
|
|
{
|
|
return Enumerable.Empty<IXunitTestCase>();
|
|
}
|
|
|
|
return new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), TestMethodDisplayOptions.None, testMethod) };
|
|
}
|
|
}
|
|
|
|
[XunitTestCaseDiscoverer("Octokit.Tests.Integration.ApplicationTestDiscoverer", "Octokit.Tests.Integration")]
|
|
public class ApplicationTestAttribute : FactAttribute
|
|
{
|
|
}
|
|
}
|