From 4b3a22864b6eb865bd7f640abc1f542eaf50f0f7 Mon Sep 17 00:00:00 2001 From: Andy Stark Date: Fri, 28 Aug 2026 11:31:37 +0100 Subject: [PATCH] DOC-7011 Stub SkipIfRedisFactAttribute so nredisstack cmds_generic compiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The portable C# harness's stubs.cs stands in for NRedisStack's own test fixtures so a doc example can run under plain xunit. It covered AbstractNRedisStackTest and [SkippableFact] but not [SkipIfRedisFact(...)], which cmds_generic's example uses to skip on old servers — so nredisstack failed to compile (CS0246) on that one set. Added a minimal Comparison enum and a no-op SkipIfRedisFactAttribute, matching the existing SkippableFact stub's philosophy: the harness always runs against a recent Redis, so there's no need to reproduce NRedisStack's real version-detection logic. Upstream's actual attribute (checked against a local NRedisStack clone) has moved twice: an older SkipIfRedisAttribute, then today's much larger SkipIfRedisFactAttribute built on custom xunit v3 discoverers. Neither is worth mirroring here — the stub only has to satisfy the one constructor overload docs examples actually call. cmds_hash, cmds_stream, geoindex, search_quickstart and time_series_tutorial still FAIL for nredisstack under this harness, but for unrelated reasons confirmed by their error messages: the ambient local Redis (7.2.7, no modules) doesn't have HEXPIRE, FT.CREATE, or TS.CREATE. Not a regression from this change and not in scope for this ticket. Learned: the doc example's [SkipIfRedisFact] attribute name doesn't match any class in an older local NRedisStack clone (SkipIfRedisAttribute) — upstream has renamed/rebuilt this fixture at least twice; don't assume a name in a doc example still matches the current upstream source Constraint: keep stubs.cs minimal — it only needs to satisfy the constructor overloads doc examples actually call ([SkipIfRedisFact(Comparison.LessThan, "7.0.0")] today), not reproduce NRedisStack's real skip/version logic Gaps: cmds_hash/cmds_stream/geoindex/search_quickstart/time_series_tutorial still fail nredisstack under --portable — the ambient Redis lacks HEXPIRE and the search/timeseries modules, unrelated to this fix Ticket: DOC-7011 --- build/example-test-harness/dotnet/stubs.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build/example-test-harness/dotnet/stubs.cs b/build/example-test-harness/dotnet/stubs.cs index 7901bd88ba..e4dc88de50 100644 --- a/build/example-test-harness/dotnet/stubs.cs +++ b/build/example-test-harness/dotnet/stubs.cs @@ -26,6 +26,16 @@ protected IDatabase GetCleanDatabase(EndpointsFixture.Env env) // The examples annotate the test method [SkippableFact]; make it a plain Fact. public class SkippableFactAttribute : FactAttribute { } + + // Some examples annotate with [SkipIfRedisFact(Comparison.LessThan, "7.0.0")] to skip + // on old servers. The harness always runs against a recent Redis, so make it a plain + // Fact too rather than reproducing NRedisStack's real version-detection logic. + public enum Comparison { LessThan, GreaterThanOrEqual } + + public class SkipIfRedisFactAttribute : FactAttribute + { + public SkipIfRedisFactAttribute(Comparison comparison, string targetVersion) { } + } } // Satisfy [Collection("DocsTests")] + constructor injection of EndpointsFixture.