Skip to content

Commit e15ffbf

Browse files
committed
Stop using Xunit.SkippableFact
We just upgraded `Xunit.SkippableFact` to v1.4.13, available at https://www.nuget.org/packages/Xunit.SkippableFact, but even though enough time has passed since v1.4.13 was published on July 9th, 2024, in the meantime no corresponding tag has been pushed to https://github.com/AArnott/Xunit.SkippableFact/tags. Besides, during that time, XUnit has grown features that mean that we do not need the `SkippableFact` package anymore. So let's use those XUnit-native constructs instead, and drop the `SkippableFact` dependency altogether. Helped-by: Matthew Cheetham <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 8bfe765 commit e15ffbf

16 files changed

+120
-102
lines changed

src/shared/Core.Tests/EnvironmentTests.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class EnvironmentTests
1515
private const string PosixPathVar = "/home/john.doe/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin";
1616
private const string PosixExecName = "foo";
1717

18-
[PlatformFact(Platforms.Windows)]
18+
[WindowsFact]
1919
public void WindowsEnvironment_TryLocateExecutable_NotExists_ReturnFalse()
2020
{
2121
var fs = new TestFileSystem();
@@ -28,7 +28,7 @@ public void WindowsEnvironment_TryLocateExecutable_NotExists_ReturnFalse()
2828
Assert.Null(actualPath);
2929
}
3030

31-
[PlatformFact(Platforms.Windows)]
31+
[WindowsFact]
3232
public void WindowsEnvironment_TryLocateExecutable_Exists_ReturnTrueAndPath()
3333
{
3434
string expectedPath = @"C:\Windows\system32\foo.exe";
@@ -48,7 +48,7 @@ public void WindowsEnvironment_TryLocateExecutable_Exists_ReturnTrueAndPath()
4848
Assert.Equal(expectedPath, actualPath);
4949
}
5050

51-
[PlatformFact(Platforms.Windows)]
51+
[WindowsFact]
5252
public void WindowsEnvironment_TryLocateExecutable_ExistsMultiple_ReturnTrueAndFirstPath()
5353
{
5454
string expectedPath = @"C:\Users\john.doe\bin\foo.exe";
@@ -70,7 +70,7 @@ public void WindowsEnvironment_TryLocateExecutable_ExistsMultiple_ReturnTrueAndF
7070
Assert.Equal(expectedPath, actualPath);
7171
}
7272

73-
[PlatformFact(Platforms.Posix)]
73+
[PosixFact]
7474
public void PosixEnvironment_TryLocateExecutable_NotExists_ReturnFalse()
7575
{
7676
var fs = new TestFileSystem();
@@ -83,7 +83,7 @@ public void PosixEnvironment_TryLocateExecutable_NotExists_ReturnFalse()
8383
Assert.Null(actualPath);
8484
}
8585

86-
[PlatformFact(Platforms.Posix)]
86+
[PosixFact]
8787
public void PosixEnvironment_TryLocateExecutable_Exists_ReturnTrueAndPath()
8888
{
8989
string expectedPath = "/usr/local/bin/foo";
@@ -103,7 +103,7 @@ public void PosixEnvironment_TryLocateExecutable_Exists_ReturnTrueAndPath()
103103
Assert.Equal(expectedPath, actualPath);
104104
}
105105

106-
[PlatformFact(Platforms.Posix)]
106+
[PosixFact]
107107
public void PosixEnvironment_TryLocateExecutable_ExistsMultiple_ReturnTrueAndFirstPath()
108108
{
109109
string expectedPath = "/home/john.doe/bin/foo";
@@ -125,7 +125,7 @@ public void PosixEnvironment_TryLocateExecutable_ExistsMultiple_ReturnTrueAndFir
125125
Assert.Equal(expectedPath, actualPath);
126126
}
127127

128-
[PlatformFact(Platforms.MacOS)]
128+
[MacOSFact]
129129
public void MacOSEnvironment_TryLocateExecutable_Paths_Are_Ignored()
130130
{
131131
List<string> pathsToIgnore = new List<string>()
@@ -150,8 +150,8 @@ public void MacOSEnvironment_TryLocateExecutable_Paths_Are_Ignored()
150150
Assert.True(actualResult);
151151
Assert.Equal(expectedPath, actualPath);
152152
}
153-
154-
[PlatformFact(Platforms.Posix)]
153+
154+
[PosixFact]
155155
public void PosixEnvironment_SetEnvironmentVariable_Sets_Expected_Value()
156156
{
157157
var variable = "FOO_BAR";
@@ -166,8 +166,8 @@ public void PosixEnvironment_SetEnvironmentVariable_Sets_Expected_Value()
166166
Assert.Contains(env.Variables, item
167167
=> item.Key.Equals(variable) && item.Value.Equals(value));
168168
}
169-
170-
[PlatformFact(Platforms.Windows)]
169+
170+
[WindowsFact]
171171
public void WindowsEnvironment_SetEnvironmentVariable_Sets_Expected_Value()
172172
{
173173
var variable = "FOO_BAR";

src/shared/Core.Tests/GenericHostProviderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ public async Task GenericHostProvider_CreateCredentialAsync_NonHttpProtocol_Retu
169169
basicAuthMock.Verify(x => x.GetCredentialsAsync(It.IsAny<string>(), It.IsAny<string>()), Times.Once);
170170
}
171171

172-
[PlatformFact(Platforms.Posix)]
172+
[PosixFact]
173173
public async Task GenericHostProvider_CreateCredentialAsync_NonWindows_WiaSupported_ReturnsBasicCredential()
174174
{
175175
await TestCreateCredentialAsync_ReturnsBasicCredential(wiaSupported: true);
176176
}
177177

178-
[PlatformFact(Platforms.Windows)]
178+
[WindowsFact]
179179
public async Task GenericHostProvider_CreateCredentialAsync_Windows_WiaSupported_ReturnsEmptyCredential()
180180
{
181181
await TestCreateCredentialAsync_ReturnsEmptyCredential(wiaSupported: true);

src/shared/Core.Tests/Interop/Linux/LinuxFileSystemTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace GitCredentialManager.Tests.Interop.Linux
77
{
88
public class LinuxFileSystemTests
99
{
10-
[PlatformFact(Platforms.Linux)]
10+
[LinuxFact]
1111
public static void LinuxFileSystem_IsSamePath_SamePath_ReturnsTrue()
1212
{
1313
var fs = new LinuxFileSystem();
@@ -18,7 +18,7 @@ public static void LinuxFileSystem_IsSamePath_SamePath_ReturnsTrue()
1818
Assert.True(fs.IsSamePath(fileA, fileA));
1919
}
2020

21-
[PlatformFact(Platforms.Linux)]
21+
[LinuxFact]
2222
public static void LinuxFileSystem_IsSamePath_DifferentFile_ReturnsFalse()
2323
{
2424
var fs = new LinuxFileSystem();
@@ -31,7 +31,7 @@ public static void LinuxFileSystem_IsSamePath_DifferentFile_ReturnsFalse()
3131
Assert.False(fs.IsSamePath(fileB, fileA));
3232
}
3333

34-
[PlatformFact(Platforms.Linux)]
34+
[LinuxFact]
3535
public static void LinuxFileSystem_IsSamePath_SameFileDifferentCase_ReturnsFalse()
3636
{
3737
var fs = new LinuxFileSystem();
@@ -44,7 +44,7 @@ public static void LinuxFileSystem_IsSamePath_SameFileDifferentCase_ReturnsFalse
4444
Assert.False(fs.IsSamePath(fileA2, fileA1));
4545
}
4646

47-
[PlatformFact(Platforms.Linux)]
47+
[LinuxFact]
4848
public static void LinuxFileSystem_IsSamePath_SameFileDifferentPathNormalization_ReturnsTrue()
4949
{
5050
var fs = new LinuxFileSystem();
@@ -58,7 +58,7 @@ public static void LinuxFileSystem_IsSamePath_SameFileDifferentPathNormalization
5858
Assert.True(fs.IsSamePath(fileA2, fileA1));
5959
}
6060

61-
[PlatformFact(Platforms.Linux)]
61+
[LinuxFact]
6262
public static void LinuxFileSystem_IsSamePath_SameFileViaSymlink_ReturnsTrue()
6363
{
6464
var fs = new LinuxFileSystem();
@@ -71,7 +71,7 @@ public static void LinuxFileSystem_IsSamePath_SameFileViaSymlink_ReturnsTrue()
7171
Assert.True(fs.IsSamePath(fileA2, fileA1));
7272
}
7373

74-
[PlatformFact(Platforms.Linux)]
74+
[LinuxFact]
7575
public static void LinuxFileSystem_IsSamePath_SameFileRelativePath_ReturnsTrue()
7676
{
7777
var fs = new LinuxFileSystem();

src/shared/Core.Tests/Interop/Linux/SecretServiceCollectionTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class SecretServiceCollectionTests
88
{
99
private const string TestNamespace = "git-test";
1010

11-
[PlatformFact(Platforms.Linux, Skip = "Cannot run headless")]
11+
[LinuxFact(Skip = "Cannot run headless")]
1212
public void SecretServiceCollection_ReadWriteDelete()
1313
{
1414
var collection = new SecretServiceCollection(TestNamespace);
@@ -37,7 +37,7 @@ public void SecretServiceCollection_ReadWriteDelete()
3737
}
3838
}
3939

40-
[PlatformFact(Platforms.Linux, Skip = "Cannot run headless")]
40+
[LinuxFact(Skip = "Cannot run headless")]
4141
public void SecretServiceCollection_Get_NotFound_ReturnsNull()
4242
{
4343
var collection = new SecretServiceCollection(TestNamespace);
@@ -49,7 +49,7 @@ public void SecretServiceCollection_Get_NotFound_ReturnsNull()
4949
Assert.Null(credential);
5050
}
5151

52-
[PlatformFact(Platforms.Linux, Skip = "Cannot run headless")]
52+
[LinuxFact(Skip = "Cannot run headless")]
5353
public void SecretServiceCollection_Remove_NotFound_ReturnsFalse()
5454
{
5555
var collection = new SecretServiceCollection(TestNamespace);

src/shared/Core.Tests/Interop/MacOS/MacOSFileSystemTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace GitCredentialManager.Tests.Interop.MacOS
77
{
88
public class MacOSFileSystemTests
99
{
10-
[PlatformFact(Platforms.MacOS)]
10+
[MacOSFact]
1111
public static void MacOSFileSystem_IsSamePath_SamePath_ReturnsTrue()
1212
{
1313
var fs = new MacOSFileSystem();
@@ -18,7 +18,7 @@ public static void MacOSFileSystem_IsSamePath_SamePath_ReturnsTrue()
1818
Assert.True(fs.IsSamePath(fileA, fileA));
1919
}
2020

21-
[PlatformFact(Platforms.MacOS)]
21+
[MacOSFact]
2222
public static void MacOSFileSystem_IsSamePath_DifferentFile_ReturnsFalse()
2323
{
2424
var fs = new MacOSFileSystem();
@@ -31,7 +31,7 @@ public static void MacOSFileSystem_IsSamePath_DifferentFile_ReturnsFalse()
3131
Assert.False(fs.IsSamePath(fileB, fileA));
3232
}
3333

34-
[PlatformFact(Platforms.MacOS)]
34+
[MacOSFact]
3535
public static void MacOSFileSystem_IsSamePath_SameFileDifferentCase_ReturnsTrue()
3636
{
3737
var fs = new MacOSFileSystem();
@@ -44,7 +44,7 @@ public static void MacOSFileSystem_IsSamePath_SameFileDifferentCase_ReturnsTrue(
4444
Assert.True(fs.IsSamePath(fileA2, fileA1));
4545
}
4646

47-
[PlatformFact(Platforms.MacOS)]
47+
[MacOSFact]
4848
public static void MacOSFileSystem_IsSamePath_SameFileDifferentPathNormalization_ReturnsTrue()
4949
{
5050
var fs = new MacOSFileSystem();
@@ -58,7 +58,7 @@ public static void MacOSFileSystem_IsSamePath_SameFileDifferentPathNormalization
5858
Assert.True(fs.IsSamePath(fileA2, fileA1));
5959
}
6060

61-
[PlatformFact(Platforms.MacOS)]
61+
[MacOSFact]
6262
public static void MacOSFileSystem_IsSamePath_SameFileViaSymlink_ReturnsTrue()
6363
{
6464
var fs = new MacOSFileSystem();
@@ -71,7 +71,7 @@ public static void MacOSFileSystem_IsSamePath_SameFileViaSymlink_ReturnsTrue()
7171
Assert.True(fs.IsSamePath(fileA2, fileA1));
7272
}
7373

74-
[PlatformFact(Platforms.MacOS)]
74+
[MacOSFact]
7575
public static void MacOSFileSystem_IsSamePath_SameFileRelativePath_ReturnsTrue()
7676
{
7777
var fs = new MacOSFileSystem();

src/shared/Core.Tests/Interop/MacOS/MacOSKeychainTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class MacOSKeychainTests
1010
{
1111
private const string TestNamespace = "git-test";
1212

13-
[SkippablePlatformFact(Platforms.MacOS)]
13+
[MacOSFact]
1414
public void MacOSKeychain_ReadWriteDelete()
1515
{
1616
var keychain = new MacOSKeychain(TestNamespace);
@@ -52,7 +52,7 @@ public void MacOSKeychain_ReadWriteDelete()
5252
}
5353
}
5454

55-
[PlatformFact(Platforms.MacOS)]
55+
[MacOSFact]
5656
public void MacOSKeychain_Get_NotFound_ReturnsNull()
5757
{
5858
var keychain = new MacOSKeychain(TestNamespace);
@@ -64,7 +64,7 @@ public void MacOSKeychain_Get_NotFound_ReturnsNull()
6464
Assert.Null(credential);
6565
}
6666

67-
[PlatformFact(Platforms.MacOS)]
67+
[MacOSFact]
6868
public void MacOSKeychain_Remove_NotFound_ReturnsFalse()
6969
{
7070
var keychain = new MacOSKeychain(TestNamespace);

src/shared/Core.Tests/Interop/Posix/GnuPassCredentialStoreTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class GnuPassCredentialStoreTests
1111
{
1212
private const string TestNamespace = "git-test";
1313

14-
[PlatformFact(Platforms.Posix)]
14+
[PosixFact]
1515
public void GnuPassCredentialStore_ReadWriteDelete()
1616
{
1717
var fs = new TestFileSystem();
@@ -54,7 +54,7 @@ public void GnuPassCredentialStore_ReadWriteDelete()
5454
}
5555
}
5656

57-
[PlatformFact(Platforms.Posix)]
57+
[PosixFact]
5858
public void GnuPassCredentialStore_Get_NotFound_ReturnsNull()
5959
{
6060
var fs = new TestFileSystem();
@@ -70,7 +70,7 @@ public void GnuPassCredentialStore_Get_NotFound_ReturnsNull()
7070
Assert.Null(credential);
7171
}
7272

73-
[PlatformFact(Platforms.Posix)]
73+
[PosixFact]
7474
public void GnuPassCredentialStore_Remove_NotFound_ReturnsFalse()
7575
{
7676
var fs = new TestFileSystem();

src/shared/Core.Tests/Interop/Posix/PosixFileSystemTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace GitCredentialManager.Tests.Interop.Posix
77
{
88
public class PosixFileSystemTests
99
{
10-
[PlatformFact(Platforms.Posix)]
10+
[PosixFact]
1111
public void PosixFileSystem_ResolveSymlinks_FileLinks()
1212
{
1313
string baseDir = GetTempDirectory();
@@ -19,7 +19,7 @@ public void PosixFileSystem_ResolveSymlinks_FileLinks()
1919
Assert.Equal(realPath, actual);
2020
}
2121

22-
[PlatformFact(Platforms.Posix)]
22+
[PosixFact]
2323
public void PosixFileSystem_ResolveSymlinks_DirectoryLinks()
2424
{
2525
//

src/shared/Core.Tests/Interop/Windows/DpapiCredentialStoreTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class DpapiCredentialStoreTests
1313
private const string TestStoreRoot = @"C:\dpapi_store";
1414
private const string TestNamespace = "git-test";
1515

16-
[PlatformFact(Platforms.Windows)]
16+
[WindowsFact]
1717
public void DpapiCredentialStore_AddOrUpdate_CreatesUTF8ProtectedFile()
1818
{
1919
var fs = new TestFileSystem();
@@ -49,7 +49,7 @@ public void DpapiCredentialStore_AddOrUpdate_CreatesUTF8ProtectedFile()
4949
Assert.True(string.IsNullOrWhiteSpace(lines[3]));
5050
}
5151

52-
[PlatformFact(Platforms.Windows)]
52+
[WindowsFact]
5353
public void DpapiCredentialStore_Get_KeyNotFound_ReturnsNull()
5454
{
5555
var fs = new TestFileSystem();
@@ -62,7 +62,7 @@ public void DpapiCredentialStore_Get_KeyNotFound_ReturnsNull()
6262
Assert.Null(credential);
6363
}
6464

65-
[PlatformFact(Platforms.Windows)]
65+
[WindowsFact]
6666
public void DpapiCredentialStore_Get_ReadProtectedFile()
6767
{
6868
var fs = new TestFileSystem();
@@ -97,7 +97,7 @@ public void DpapiCredentialStore_Get_ReadProtectedFile()
9797
Assert.Equal(userName, credential.Account);
9898
}
9999

100-
[PlatformFact(Platforms.Windows)]
100+
[WindowsFact]
101101
public void DpapiCredentialStore_Remove_KeyNotFound_ReturnsFalse()
102102
{
103103
var fs = new TestFileSystem();

0 commit comments

Comments
 (0)