From 9af9968260cee1a09c2f00d900e41c2c3888e1ba Mon Sep 17 00:00:00 2001 From: atakavci Date: Thu, 23 Jan 2025 15:29:04 +0300 Subject: [PATCH] test without skippableTheory --- .github/workflows/integration.yml | 1 + .../NRedisStack.Tests/SkipIfRedisAttribute.cs | 3 +- .../SkippableTheoryDiscoverer.cs | 61 ------------------- 3 files changed, 2 insertions(+), 63 deletions(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index f1bcbd17..46293074 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -7,6 +7,7 @@ on: - '**/*.md' branches: - master + - ali/fix_ci_wind_tests pull_request: schedule: - cron: "0 1 * * *" diff --git a/tests/NRedisStack.Tests/SkipIfRedisAttribute.cs b/tests/NRedisStack.Tests/SkipIfRedisAttribute.cs index acfebfe3..4fb8a67f 100644 --- a/tests/NRedisStack.Tests/SkipIfRedisAttribute.cs +++ b/tests/NRedisStack.Tests/SkipIfRedisAttribute.cs @@ -15,8 +15,7 @@ public enum Is } [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] -[XunitTestCaseDiscoverer("NRedisStack.Tests.SkippableTheoryDiscoverer", "NRedisStack.Tests")] -public class SkipIfRedisAttribute : SkippableTheoryAttribute +public class SkipIfRedisAttribute : TheoryAttribute { private readonly string _targetVersion; private readonly Comparison _comparison; diff --git a/tests/NRedisStack.Tests/SkippableTheoryDiscoverer.cs b/tests/NRedisStack.Tests/SkippableTheoryDiscoverer.cs index a7e6535e..e69de29b 100644 --- a/tests/NRedisStack.Tests/SkippableTheoryDiscoverer.cs +++ b/tests/NRedisStack.Tests/SkippableTheoryDiscoverer.cs @@ -1,61 +0,0 @@ -using Xunit.Sdk; - -namespace NRedisStack.Tests; - -// TODO(imalinovskiy): Remove this file once tests are migrated to Xunit v3 - -/// Copyright (c) Andrew Arnott. All rights reserved. -// Licensed under the Microsoft Public License (Ms-PL). -// https://github.com/AArnott/Xunit.SkippableFact/blob/main/src/Xunit.SkippableFact/Sdk/SkippableTheoryDiscoverer.cs -// See https://github.com/AArnott/Xunit.SkippableFact/blob/main/LICENSE for full license information. - -using System.Collections.Generic; -using Validation; -using Xunit.Abstractions; - -/// -/// Patched TestCase discoverer to support SkipIfRedisAttribute. -/// -public class SkippableTheoryDiscoverer : IXunitTestCaseDiscoverer -{ - /// - /// The diagnostic message sink provided to the constructor. - /// - private readonly IMessageSink diagnosticMessageSink; - - /// - /// The complex theory discovery process that we wrap. - /// - private readonly TheoryDiscoverer theoryDiscoverer; - - /// - /// Initializes a new instance of the class. - /// - /// The message sink used to send diagnostic messages. - public SkippableTheoryDiscoverer(IMessageSink diagnosticMessageSink) - { - this.diagnosticMessageSink = diagnosticMessageSink; - this.theoryDiscoverer = new TheoryDiscoverer(diagnosticMessageSink); - } - - /// - public virtual IEnumerable Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute) - { - Requires.NotNull(factAttribute, nameof(factAttribute)); - string[] skippingExceptionNames = new[] { "Xunit.SkippableFact.SkipException" }; - TestMethodDisplay defaultMethodDisplay = discoveryOptions.MethodDisplayOrDefault(); - - IEnumerable? basis = this.theoryDiscoverer.Discover(discoveryOptions, testMethod, factAttribute); - foreach (IXunitTestCase? testCase in basis) - { - if (testCase is XunitTheoryTestCase) - { - yield return new SkippableTheoryTestCase(skippingExceptionNames, this.diagnosticMessageSink, defaultMethodDisplay, discoveryOptions.MethodDisplayOptionsOrDefault(), testCase.TestMethod); - } - else - { - yield return new SkippableFactTestCase(skippingExceptionNames, this.diagnosticMessageSink, defaultMethodDisplay, discoveryOptions.MethodDisplayOptionsOrDefault(), testCase.TestMethod, testCase.TestMethodArguments); - } - } - } -} \ No newline at end of file