forked from git-tfs/git-tfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFactExceptOnUnix.cs
More file actions
33 lines (28 loc) · 1009 Bytes
/
Copy pathFactExceptOnUnix.cs
File metadata and controls
33 lines (28 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Collections.Generic;
using Xunit;
using Xunit.Sdk;
namespace Sep.Git.Tfs.Test
{
public class FactExceptOnUnixAttribute : FactAttribute
{
protected override IEnumerable<ITestCommand> EnumerateTestCommands(IMethodInfo method)
{
yield return new FactExceptOnUnixTestCommand(method);
}
class FactExceptOnUnixTestCommand : FactCommand
{
public FactExceptOnUnixTestCommand(IMethodInfo method) : base(method) { }
public override MethodResult Execute(object testClass)
{
if(IsUnix())
return new SkipResult(testMethod, DisplayName, "This test does not work on unix-like OSes yet.");
return base.Execute(testClass);
}
private bool IsUnix()
{
return Environment.OSVersion.Platform == PlatformID.Unix || Environment.OSVersion.Platform == PlatformID.MacOSX;
}
}
}
}