Skip to content

Commit 0a1f468

Browse files
committed
enable doc tests with new test infra
1 parent a2f17a4 commit 0a1f468

26 files changed

+187
-121
lines changed

tests/Doc/Bf_tutorial.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ namespace Doc;
1313
// REMOVE_END
1414

1515
// HIDE_START
16-
public class Bf_tutorial
16+
public class Bf_tutorial : AbstractNRedisStackTest, IDisposable
1717
{
18-
19-
public void run()
18+
public Bf_tutorial(EndpointsFixture fixture) : base(fixture) { }
19+
20+
[SkippableTheory]
21+
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
22+
public void run(string endpointId)
2023
{
21-
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
22-
var db = muxer.GetDatabase();
24+
var db = GetCleanDatabase(endpointId);
2325
//REMOVE_START
2426
// Clear any keys here before using them in tests.
2527
db.KeyDelete("bikes:models");

tests/Doc/Bitmap_tutorial.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ namespace Doc;
1212
// REMOVE_END
1313

1414
// HIDE_START
15-
public class Bitmap_tutorial
15+
public class Bitmap_tutorial : AbstractNRedisStackTest, IDisposable
1616
{
17-
18-
public void run()
17+
public Bitmap_tutorial(EndpointsFixture fixture) : base(fixture) { }
18+
19+
[SkippableTheory]
20+
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
21+
public void run(string endpointId)
1922
{
20-
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
21-
var db = muxer.GetDatabase();
23+
var db = GetCleanDatabase(endpointId);
2224
//REMOVE_START
2325
// Clear any keys here before using them in tests.
2426
db.KeyDelete("pings:2024-01-01-00:00");

tests/Doc/CmdsGenericExample.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@ namespace Doc;
1212
// REMOVE_END
1313

1414
// HIDE_START
15-
public class CmdsGenericExample
15+
public class CmdsGenericExample : AbstractNRedisStackTest, IDisposable
1616
{
17+
public CmdsGenericExample(EndpointsFixture fixture) : base(fixture) { }
1718

18-
public void run()
19+
20+
[SkipIfRedis(Comparison.LessThan, "7.0.0")]
21+
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
22+
23+
public void run(string endpointId)
1924
{
20-
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
21-
var db = muxer.GetDatabase();
25+
var db = GetCleanDatabase(endpointId);
2226
//REMOVE_START
2327
// Clear any keys here before using them in tests.
2428

tests/Doc/CmdsHashExample.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ namespace Doc;
1010
// REMOVE_END
1111

1212
// HIDE_START
13-
public class CmdsHashExample
13+
public class CmdsHashExample: AbstractNRedisStackTest, IDisposable
1414
{
15-
16-
public void run()
15+
public CmdsHashExample(EndpointsFixture fixture) : base(fixture) { }
16+
17+
[SkippableTheory]
18+
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
19+
public void run(string endpointId)
1720
{
18-
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
19-
var db = muxer.GetDatabase();
21+
var db = GetCleanDatabase(endpointId);
2022
//REMOVE_START
2123
// Clear any keys here before using them in tests.
2224
db.KeyDelete("myhash");

tests/Doc/CmdsSortedSetExamples.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ namespace Doc;
1212
// REMOVE_END
1313

1414
// HIDE_START
15-
public class CmdsSortedSet
15+
public class CmdsSortedSet: AbstractNRedisStackTest, IDisposable
1616
{
17-
18-
public void run()
17+
public CmdsSortedSet(EndpointsFixture fixture) : base(fixture) { }
18+
19+
[SkippableTheory]
20+
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
21+
public void run(string endpointId)
1922
{
20-
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
21-
var db = muxer.GetDatabase();
23+
var db = GetCleanDatabase(endpointId);
2224
//REMOVE_START
2325
// Clear any keys here before using them in tests.
2426

tests/Doc/CmdsStringExample.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ namespace Doc;
1212
// REMOVE_END
1313

1414
// HIDE_START
15-
public class CmdsStringExample
15+
public class CmdsStringExample: AbstractNRedisStackTest, IDisposable
1616
{
17-
18-
public void run()
17+
public CmdsStringExample(EndpointsFixture fixture) : base(fixture) { }
18+
19+
[SkippableTheory]
20+
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
21+
public void run(string endpointId)
1922
{
20-
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
21-
var db = muxer.GetDatabase();
23+
var db = GetCleanDatabase(endpointId);
2224
//REMOVE_START
2325
// Clear any keys here before using them in tests.
2426

tests/Doc/Cms_tutorial.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ namespace Doc;
1414
// REMOVE_END
1515

1616
// HIDE_START
17-
public class Cms_tutorial
17+
public class Cms_tutorial : AbstractNRedisStackTest, IDisposable
1818
{
19-
20-
public void run()
19+
public Cms_tutorial(EndpointsFixture fixture) : base(fixture) { }
20+
21+
[SkippableTheory]
22+
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
23+
public void run(string endpointId)
2124
{
22-
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
23-
var db = muxer.GetDatabase();
25+
var db = GetCleanDatabase(endpointId);
2426
//REMOVE_START
2527
// Clear any keys here before using them in tests.
2628
db.KeyDelete("bikes:profit");

tests/Doc/Cuckoo_tutorial.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ namespace Doc;
1313
// REMOVE_END
1414

1515
// HIDE_START
16-
public class Cuckoo_tutorial
16+
public class Cuckoo_tutorial : AbstractNRedisStackTest, IDisposable
1717
{
18-
19-
public void run()
18+
public Cuckoo_tutorial(EndpointsFixture fixture) : base(fixture) { }
19+
20+
[SkippableTheory]
21+
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
22+
public void run(string endpointId)
2023
{
21-
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
22-
var db = muxer.GetDatabase();
24+
var db = GetCleanDatabase(endpointId);
2325
//REMOVE_START
2426
// Clear any keys here before using them in tests.
2527
db.KeyDelete("bikes:models");

tests/Doc/Geo_tutorial.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ namespace Doc;
1212
// REMOVE_END
1313

1414
// HIDE_START
15-
public class Geo_tutorial
15+
public class Geo_tutorial : AbstractNRedisStackTest, IDisposable
1616
{
17-
18-
public void run()
17+
public Geo_tutorial(EndpointsFixture fixture) : base(fixture) { }
18+
19+
[SkippableTheory]
20+
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
21+
public void run(string endpointId)
1922
{
20-
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
21-
var db = muxer.GetDatabase();
23+
var db = GetCleanDatabase(endpointId);
2224
//REMOVE_START
2325
// Clear any keys here before using them in tests.
2426
db.KeyDelete("bikes:rentable");

tests/Doc/HashExample.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88
namespace Doc;
99
[Collection("DocsTests")]
1010
//REMOVE_END
11-
public class HashExample
11+
public class HashExample: AbstractNRedisStackTest, IDisposable
1212
{
13-
14-
public void run()
13+
public HashExample(EndpointsFixture fixture) : base(fixture) { }
14+
15+
[SkippableTheory]
16+
[MemberData(nameof(EndpointsFixture.Env.StandaloneOnly), MemberType = typeof(EndpointsFixture.Env))]
17+
public void run(string endpointId)
1518
{
16-
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
17-
var db = muxer.GetDatabase();
19+
var db = GetCleanDatabase(endpointId);
1820
db.KeyDelete("bike:1");
1921
//HIDE_END
2022
//STEP_START set_get_all

0 commit comments

Comments
 (0)