From e0333087420291eb4c608f238b3d37c574233a84 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 4 Jan 2015 16:01:17 +0930 Subject: [PATCH] why the hell don't you work --- .../Helpers/ApplicationTestAttribute.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Octokit.Tests.Integration/Helpers/ApplicationTestAttribute.cs b/Octokit.Tests.Integration/Helpers/ApplicationTestAttribute.cs index b5d38c8c..96df3643 100644 --- a/Octokit.Tests.Integration/Helpers/ApplicationTestAttribute.cs +++ b/Octokit.Tests.Integration/Helpers/ApplicationTestAttribute.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using Xunit; using Xunit.Abstractions; using Xunit.Sdk; @@ -14,12 +13,11 @@ namespace Octokit.Tests.Integration if (String.IsNullOrWhiteSpace(Helper.ClientId) && String.IsNullOrWhiteSpace(Helper.ClientSecret)) { - return Enumerable.Empty(); - } - else - { - return new[] { new XunitTestCase(testMethod) }; + yield return new SkipTestCase(testMethod, + "Environment variables are not set for this test - set OCTOKIT_CLIENTID and OCTOKIT_CLIENTSECRET"); } + + yield return new XunitTestCase(testMethod); } } @@ -27,4 +25,13 @@ namespace Octokit.Tests.Integration public class ApplicationTestAttribute : FactAttribute { } + + public class SkipTestCase : XunitTestCase + { + public SkipTestCase(ITestMethod testMethod, string skipReason) + : base(testMethod) + { + SkipReason = skipReason; + } + } }