Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'LibGit2Sharp.Tests/TestHelpers/SkippableFactAttribute.cs')
-rw-r--r--LibGit2Sharp.Tests/TestHelpers/SkippableFactAttribute.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/LibGit2Sharp.Tests/TestHelpers/SkippableFactAttribute.cs b/LibGit2Sharp.Tests/TestHelpers/SkippableFactAttribute.cs
new file mode 100644
index 00000000..4cd6d7a8
--- /dev/null
+++ b/LibGit2Sharp.Tests/TestHelpers/SkippableFactAttribute.cs
@@ -0,0 +1,31 @@
+using System.Collections.Generic;
+using Xunit;
+using Xunit.Sdk;
+
+namespace LibGit2Sharp.Tests.TestHelpers
+{
+ class SkippableFactAttribute : FactAttribute
+ {
+ protected override IEnumerable<ITestCommand> EnumerateTestCommands(IMethodInfo method)
+ {
+ yield return new SkippableTestCommand(method);
+ }
+
+ class SkippableTestCommand : FactCommand
+ {
+ public SkippableTestCommand(IMethodInfo method) : base(method) { }
+
+ public override MethodResult Execute(object testClass)
+ {
+ try
+ {
+ return base.Execute(testClass);
+ }
+ catch (SkipException e)
+ {
+ return new SkipResult(testMethod, DisplayName, e.Reason);
+ }
+ }
+ }
+ }
+} \ No newline at end of file