diff --git a/Octokit.Tests.Integration/Clients/TeamsClientTests.cs b/Octokit.Tests.Integration/Clients/TeamsClientTests.cs index 21e6a59c..99b4c12a 100644 --- a/Octokit.Tests.Integration/Clients/TeamsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/TeamsClientTests.cs @@ -6,6 +6,7 @@ using Octokit.Tests.Helpers; using Octokit.Tests.Integration; using Xunit; using System; +using Octokit.Tests.Integration.Clients; public class TeamsClientTests { diff --git a/Octokit.Tests.Integration/Helpers/IntegrationTestAttribute.cs b/Octokit.Tests.Integration/Helpers/IntegrationTestAttribute.cs new file mode 100644 index 00000000..3e1c1fdb --- /dev/null +++ b/Octokit.Tests.Integration/Helpers/IntegrationTestAttribute.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Threading; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; +using Xunit.Sdk; + +namespace Octokit.Tests.Integration +{ + public class IntegrationTestDiscoverer : IXunitTestCaseDiscoverer + { + public IEnumerable Discover(ITestMethod testMethod, IAttributeInfo factAttribute) + { + yield return new IntegrationTestCase(testMethod); + } + } + + + [XunitTestCaseDiscoverer("Octokit.Tests.Integration.IntegrationTestDiscoverer", "Octokit.Tests.Integration")] + public class IntegrationTestAttribute : FactAttribute + { + } + + [Serializable] + public class IntegrationTestCase : XunitTestCase + { + [EditorBrowsable(EditorBrowsableState.Never)] + [Obsolete("Called by the de-serializer", true)] + public IntegrationTestCase() { } + + public IntegrationTestCase(ITestMethod testMethod) + : base(testMethod, testMethodArguments: null) + { + } + } +} diff --git a/Octokit.Tests.Integration/Helpers/OrganizationTestAttribute.cs b/Octokit.Tests.Integration/Helpers/OrganizationTestAttribute.cs new file mode 100644 index 00000000..93e581ed --- /dev/null +++ b/Octokit.Tests.Integration/Helpers/OrganizationTestAttribute.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; +using Xunit.Sdk; + +namespace Octokit.Tests.Integration +{ + public class OrganizationTestDiscoverer : IXunitTestCaseDiscoverer + { + public IEnumerable Discover(ITestMethod testMethod, IAttributeInfo factAttribute) + { + if (Helper.Organization == null) + { + return Enumerable.Empty(); + } + else + { + return new[] { new OrganizationTestCase(testMethod) }; + } + } + } + + [XunitTestCaseDiscoverer("Octokit.Tests.Integration.OrganizationTestDiscoverer", "Octokit.Tests.Integration")] + public class OrganizationTestAttribute : FactAttribute + { + } + + [Serializable] + public class OrganizationTestCase : XunitTestCase + { + public OrganizationTestCase(ITestMethod testMethod) + : base(testMethod, testMethodArguments: null) + { + } + } + +} diff --git a/Octokit.Tests.Integration/IntegrationTestAttribute.cs b/Octokit.Tests.Integration/IntegrationTestAttribute.cs deleted file mode 100644 index 3e0a28ed..00000000 --- a/Octokit.Tests.Integration/IntegrationTestAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Collections.Generic; -using Xunit; -using Xunit.Sdk; - -namespace Octokit.Tests.Integration -{ - public class IntegrationTestAttribute : FactAttribute - { - protected override IEnumerable EnumerateTestCommands(IMethodInfo testMethod) - { - if (Helper.Credentials == null) - yield return new SkipCommand(testMethod, MethodUtility.GetDisplayName(testMethod), "Automation settings not configured. Please set the OCTOKIT_GITHUBUSERNAME and OCTOKIT_GITHUBPASSWORD environment variables to a GitHub test account (i.e, DO NOT USE A \"REAL\" ACCOUNT)."); - else - yield return new FactCommand(testMethod); - } - } -} diff --git a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj index 862035d5..b131a24a 100644 --- a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj +++ b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj @@ -61,6 +61,10 @@ ..\packages\xunit.core.2.0.0-beta5-build2785\lib\portable-net45+aspnetcore50+win+wpa81+wp80+monotouch+monoandroid\xunit.core.dll + + False + ..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.execution.dll + @@ -88,11 +92,11 @@ - + - + diff --git a/Octokit.Tests.Integration/OrganizationTestAttribute.cs b/Octokit.Tests.Integration/OrganizationTestAttribute.cs deleted file mode 100644 index 61b00cfb..00000000 --- a/Octokit.Tests.Integration/OrganizationTestAttribute.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using Xunit.Sdk; - -namespace Octokit.Tests.Integration -{ - public class OrganizationTestAttribute : IntegrationTestAttribute - { - protected override IEnumerable EnumerateTestCommands(IMethodInfo testMethod) - { - if (Helper.Organization == null) - return new[] - { - new SkipCommand(testMethod, MethodUtility.GetDisplayName(testMethod), "Automation settings not configured. Please set the OCTOKIT_GITHUBORGANIZATION environment variable to a GitHub organization owned by the test account specified in OCTOKIT_GITHUBUSERNAME.") - }; - else - return base.EnumerateTestCommands(testMethod); - } - } -} diff --git a/Octokit.Tests.Integration/Reactive/ObservableTeamsClientTests.cs b/Octokit.Tests.Integration/Reactive/ObservableTeamsClientTests.cs index bed5daa4..d5bbca36 100644 --- a/Octokit.Tests.Integration/Reactive/ObservableTeamsClientTests.cs +++ b/Octokit.Tests.Integration/Reactive/ObservableTeamsClientTests.cs @@ -11,6 +11,7 @@ using System; using System.Collections.Generic; using Xunit.Sdk; using Octokit.Reactive; +using Octokit.Tests.Integration.Clients; public class ObservableTeamsClientTests {