Skip to content

Commit 7d3114f

Browse files
devlooped-botkzu
authored andcommitted
⬆️ Bump files with dotnet-file sync
# devlooped/catbag - Fix wrong ctor types for RuntimeFact/Theory devlooped/catbag@4091497
1 parent 89fccd8 commit 7d3114f

File tree

3 files changed

+79
-4
lines changed

3 files changed

+79
-4
lines changed

.netconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
weak
143143
[file "src/Tests/Attributes.cs"]
144144
url = https://github.com/devlooped/catbag/blob/main/Xunit/Attributes.cs
145-
sha = 615c1e2521340dcd85132807b368a52ff53e4ba7
145+
sha = 40914971d4d6b42d6f8a90923b131136f7e609a5
146146

147-
etag = ec1645067cc2319c2ce3304900c260eb8ec700d50b6d8d62285914a6c96e01f9
147+
etag = c77e7b435ce1df06fb60a3b0e15a0833d8e45d4d19f366c6184140ebb4814b1a
148148
weak

readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@ OPTIONS:
459459
[![domischell](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/DominicSchell.png "domischell")](https://github.com/DominicSchell)
460460
[![Mauricio Scheffer](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/mausch.png "Mauricio Scheffer")](https://github.com/mausch)
461461
[![Justin Wendlandt](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/jwendl.png "Justin Wendlandt")](https://github.com/jwendl)
462+
[![Adrian Alonso](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/adalon.png "Adrian Alonso")](https://github.com/adalon)
463+
[![Michael Hagedorn](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/Eule02.png "Michael Hagedorn")](https://github.com/Eule02)
462464
463465
464466
<!-- sponsors.md -->

src/Tests/Attributes.cs

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
using System;
1+
#nullable enable
2+
using System;
23
using System.Collections.Generic;
4+
using System.Runtime.InteropServices;
35
using Microsoft.Extensions.Configuration;
4-
using Xunit;
56

67
namespace Xunit;
78

@@ -45,6 +46,78 @@ public CIFactAttribute()
4546
}
4647
}
4748

49+
public class RuntimeFactAttribute : FactAttribute
50+
{
51+
/// <summary>
52+
/// Use <c>nameof(OSPLatform.Windows|Linux|OSX|FreeBSD)</c>
53+
/// </summary>
54+
public RuntimeFactAttribute(string osPlatform)
55+
{
56+
if (osPlatform != null && !RuntimeInformation.IsOSPlatform(OSPlatform.Create(osPlatform)))
57+
Skip = $"Only running on {osPlatform}.";
58+
}
59+
60+
public RuntimeFactAttribute(Architecture architecture)
61+
{
62+
if (RuntimeInformation.ProcessArchitecture != architecture)
63+
Skip = $"Requires {architecture} but was {RuntimeInformation.ProcessArchitecture}.";
64+
}
65+
66+
/// <summary>
67+
/// Empty constructor for use in combination with RuntimeIdentifier property.
68+
/// </summary>
69+
public RuntimeFactAttribute() { }
70+
71+
/// <summary>
72+
/// Sets the runtime identifier the test requires to run.
73+
/// </summary>
74+
public string? RuntimeIdentifier
75+
{
76+
get => RuntimeInformation.RuntimeIdentifier;
77+
set
78+
{
79+
if (value != null && RuntimeInformation.RuntimeIdentifier != value)
80+
Skip += $"Requires {value} but was {RuntimeInformation.RuntimeIdentifier}.";
81+
}
82+
}
83+
}
84+
85+
public class RuntimeTheoryAttribute : TheoryAttribute
86+
{
87+
/// <summary>
88+
/// Use <c>nameof(OSPLatform.Windows|Linux|OSX|FreeBSD)</c>
89+
/// </summary>
90+
public RuntimeTheoryAttribute(string osPlatform)
91+
{
92+
if (osPlatform != null && !RuntimeInformation.IsOSPlatform(OSPlatform.Create(osPlatform)))
93+
Skip = $"Only running on {osPlatform}.";
94+
}
95+
96+
public RuntimeTheoryAttribute(Architecture architecture)
97+
{
98+
if (RuntimeInformation.ProcessArchitecture != architecture)
99+
Skip = $"Requires {architecture} but was {RuntimeInformation.ProcessArchitecture}.";
100+
}
101+
102+
/// <summary>
103+
/// Empty constructor for use in combination with RuntimeIdentifier property.
104+
/// </summary>
105+
public RuntimeTheoryAttribute() { }
106+
107+
/// <summary>
108+
/// Sets the runtime identifier the test requires to run.
109+
/// </summary>
110+
public string? RuntimeIdentifier
111+
{
112+
get => RuntimeInformation.RuntimeIdentifier;
113+
set
114+
{
115+
if (value != null && RuntimeInformation.RuntimeIdentifier != value)
116+
Skip += $"Requires {value} but was {RuntimeInformation.RuntimeIdentifier}.";
117+
}
118+
}
119+
}
120+
48121
public class SecretsTheoryAttribute : TheoryAttribute
49122
{
50123
public SecretsTheoryAttribute(params string[] secrets)

0 commit comments

Comments
 (0)