diff --git a/PostFundManagement.Tests/DebugOnlyFactAttribute.cs b/PostFundManagement.Tests/DebugOnlyFactAttribute.cs new file mode 100644 index 0000000..b32aeb8 --- /dev/null +++ b/PostFundManagement.Tests/DebugOnlyFactAttribute.cs @@ -0,0 +1,12 @@ +namespace PostFundManagement.Tests; + +public class DebugOnlyFactAttribute : FactAttribute +{ + public DebugOnlyFactAttribute() + { + if (!Debugger.IsAttached) + { + Skip = "This test only runs when a debugger is attached."; + } + } +} diff --git a/PostFundManagement.Tests/PostFundManagement.Tests.csproj b/PostFundManagement.Tests/PostFundManagement.Tests.csproj index 497b59a..7e7e4ae 100644 --- a/PostFundManagement.Tests/PostFundManagement.Tests.csproj +++ b/PostFundManagement.Tests/PostFundManagement.Tests.csproj @@ -28,6 +28,7 @@ + diff --git a/PostFundManagement.Tests/SkorubaUserServiceIntegrationTests.cs b/PostFundManagement.Tests/SkorubaUserServiceIntegrationTests.cs index ad0316c..517c6be 100644 --- a/PostFundManagement.Tests/SkorubaUserServiceIntegrationTests.cs +++ b/PostFundManagement.Tests/SkorubaUserServiceIntegrationTests.cs @@ -54,9 +54,8 @@ public class SkorubaUserServiceGetUserRolesIntegrationTests /// /// Integration test: Verify HttpClient is properly configured with SkorubaHttpClient name. - /// - //[Fact(Skip = "Skipping integration test")] - [Fact] + /// + [DebugOnlyFact] public void HttpClientFactory_HasSkorubaHttpClientConfigured() { // Act @@ -71,8 +70,7 @@ public class SkorubaUserServiceGetUserRolesIntegrationTests /// Integration test: Verify that the service properly formats API requests. /// Uses a fake/invalid user ID to test the HTTP request flow. /// - //[Fact(Skip = "Skipping integration test")] - [Fact] + [DebugOnlyFact] public async Task GetUserRolesAsync_SendsProperlyFormattedRequest() { // Arrange @@ -91,8 +89,7 @@ public class SkorubaUserServiceGetUserRolesIntegrationTests /// /// Integration test: Verify cancellation token is respected. /// - //[Fact(Skip = "Skipping integration test")] - [Fact] + [DebugOnlyFact] public async Task GetUserRolesAsync_RespectsCancellationToken() { // Arrange