Skip to content

Commit 125cfd3

Browse files
authored
Enable doc tests with new test infra (#391)
* enable doc tests with new test infra * formatting fixes * fix tests to include in integration pipeline * fix formatting * rename dummy var * theory parameter dropeed + format fix * fix issue in StreamTutorial
1 parent 860ad40 commit 125cfd3

26 files changed

+322
-6
lines changed

tests/Doc/Bf_tutorial.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,22 @@ namespace Doc;
1414

1515
// HIDE_START
1616
public class Bf_tutorial
17+
// REMOVE_START
18+
: AbstractNRedisStackTest, IDisposable
19+
// REMOVE_END
1720
{
21+
// REMOVE_START
22+
public Bf_tutorial(EndpointsFixture fixture) : base(fixture) { }
1823

24+
[SkippableFact]
25+
// REMOVE_END
1926
public void run()
2027
{
28+
//REMOVE_START
29+
// This is needed because we're constructing ConfigurationOptions in the test before calling GetConnection
30+
SkipIfTargetConnectionDoesNotExist(EndpointsFixture.Env.Standalone);
31+
var _ = GetCleanDatabase(EndpointsFixture.Env.Standalone);
32+
//REMOVE_END
2133
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
2234
var db = muxer.GetDatabase();
2335
//REMOVE_START

tests/Doc/Bitmap_tutorial.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,22 @@ namespace Doc;
1313

1414
// HIDE_START
1515
public class Bitmap_tutorial
16+
// REMOVE_START
17+
: AbstractNRedisStackTest, IDisposable
18+
// REMOVE_END
1619
{
20+
// REMOVE_START
21+
public Bitmap_tutorial(EndpointsFixture fixture) : base(fixture) { }
1722

23+
[SkippableFact]
24+
// REMOVE_END
1825
public void run()
1926
{
27+
//REMOVE_START
28+
// This is needed because we're constructing ConfigurationOptions in the test before calling GetConnection
29+
SkipIfTargetConnectionDoesNotExist(EndpointsFixture.Env.Standalone);
30+
var _ = GetCleanDatabase(EndpointsFixture.Env.Standalone);
31+
//REMOVE_END
2032
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
2133
var db = muxer.GetDatabase();
2234
//REMOVE_START

tests/Doc/CmdsGenericExample.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,23 @@ namespace Doc;
1313

1414
// HIDE_START
1515
public class CmdsGenericExample
16+
// REMOVE_START
17+
: AbstractNRedisStackTest, IDisposable
18+
// REMOVE_END
1619
{
20+
// REMOVE_START
21+
public CmdsGenericExample(EndpointsFixture fixture) : base(fixture) { }
1722

23+
[SkipIfRedis(Comparison.LessThan, "7.0.0")]
24+
[InlineData] // No parameters passed, but still uses Theory
25+
// REMOVE_END
1826
public void run()
1927
{
28+
//REMOVE_START
29+
// This is needed because we're constructing ConfigurationOptions in the test before calling GetConnection
30+
SkipIfTargetConnectionDoesNotExist(EndpointsFixture.Env.Standalone);
31+
var _ = GetCleanDatabase(EndpointsFixture.Env.Standalone);
32+
//REMOVE_END
2033
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
2134
var db = muxer.GetDatabase();
2235
//REMOVE_START

tests/Doc/CmdsHashExample.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,22 @@ namespace Doc;
1111

1212
// HIDE_START
1313
public class CmdsHashExample
14+
// REMOVE_START
15+
: AbstractNRedisStackTest, IDisposable
16+
// REMOVE_END
1417
{
18+
// REMOVE_START
19+
public CmdsHashExample(EndpointsFixture fixture) : base(fixture) { }
1520

21+
[SkippableFact]
22+
// REMOVE_END
1623
public void run()
1724
{
25+
//REMOVE_START
26+
// This is needed because we're constructing ConfigurationOptions in the test before calling GetConnection
27+
SkipIfTargetConnectionDoesNotExist(EndpointsFixture.Env.Standalone);
28+
var _ = GetCleanDatabase(EndpointsFixture.Env.Standalone);
29+
//REMOVE_END
1830
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
1931
var db = muxer.GetDatabase();
2032
//REMOVE_START

tests/Doc/CmdsSortedSetExamples.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,22 @@ namespace Doc;
1313

1414
// HIDE_START
1515
public class CmdsSortedSet
16+
// REMOVE_START
17+
: AbstractNRedisStackTest, IDisposable
18+
// REMOVE_END
1619
{
20+
// REMOVE_START
21+
public CmdsSortedSet(EndpointsFixture fixture) : base(fixture) { }
1722

23+
[SkippableFact]
24+
// REMOVE_END
1825
public void run()
1926
{
27+
//REMOVE_START
28+
// This is needed because we're constructing ConfigurationOptions in the test before calling GetConnection
29+
SkipIfTargetConnectionDoesNotExist(EndpointsFixture.Env.Standalone);
30+
var _ = GetCleanDatabase(EndpointsFixture.Env.Standalone);
31+
//REMOVE_END
2032
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
2133
var db = muxer.GetDatabase();
2234
//REMOVE_START

tests/Doc/CmdsStringExample.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,22 @@ namespace Doc;
1313

1414
// HIDE_START
1515
public class CmdsStringExample
16+
// REMOVE_START
17+
: AbstractNRedisStackTest, IDisposable
18+
// REMOVE_END
1619
{
20+
// REMOVE_START
21+
public CmdsStringExample(EndpointsFixture fixture) : base(fixture) { }
1722

23+
[SkippableFact]
24+
// REMOVE_END
1825
public void run()
1926
{
27+
//REMOVE_START
28+
// This is needed because we're constructing ConfigurationOptions in the test before calling GetConnection
29+
SkipIfTargetConnectionDoesNotExist(EndpointsFixture.Env.Standalone);
30+
var _ = GetCleanDatabase(EndpointsFixture.Env.Standalone);
31+
//REMOVE_END
2032
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
2133
var db = muxer.GetDatabase();
2234
//REMOVE_START

tests/Doc/Cms_tutorial.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,22 @@ namespace Doc;
1515

1616
// HIDE_START
1717
public class Cms_tutorial
18+
// REMOVE_START
19+
: AbstractNRedisStackTest, IDisposable
20+
// REMOVE_END
1821
{
22+
// REMOVE_START
23+
public Cms_tutorial(EndpointsFixture fixture) : base(fixture) { }
1924

25+
[SkippableFact]
26+
// REMOVE_END
2027
public void run()
2128
{
29+
//REMOVE_START
30+
// This is needed because we're constructing ConfigurationOptions in the test before calling GetConnection
31+
SkipIfTargetConnectionDoesNotExist(EndpointsFixture.Env.Standalone);
32+
var _ = GetCleanDatabase(EndpointsFixture.Env.Standalone);
33+
//REMOVE_END
2234
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
2335
var db = muxer.GetDatabase();
2436
//REMOVE_START

tests/Doc/Cuckoo_tutorial.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,22 @@ namespace Doc;
1414

1515
// HIDE_START
1616
public class Cuckoo_tutorial
17+
// REMOVE_START
18+
: AbstractNRedisStackTest, IDisposable
19+
// REMOVE_END
1720
{
21+
// REMOVE_START
22+
public Cuckoo_tutorial(EndpointsFixture fixture) : base(fixture) { }
1823

24+
[SkippableFact]
25+
// REMOVE_END
1926
public void run()
2027
{
28+
//REMOVE_START
29+
// This is needed because we're constructing ConfigurationOptions in the test before calling GetConnection
30+
SkipIfTargetConnectionDoesNotExist(EndpointsFixture.Env.Standalone);
31+
var _ = GetCleanDatabase(EndpointsFixture.Env.Standalone);
32+
//REMOVE_END
2133
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
2234
var db = muxer.GetDatabase();
2335
//REMOVE_START

tests/Doc/Geo_tutorial.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,22 @@ namespace Doc;
1313

1414
// HIDE_START
1515
public class Geo_tutorial
16+
// REMOVE_START
17+
: AbstractNRedisStackTest, IDisposable
18+
// REMOVE_END
1619
{
20+
// REMOVE_START
21+
public Geo_tutorial(EndpointsFixture fixture) : base(fixture) { }
1722

23+
[SkippableFact]
24+
// REMOVE_END
1825
public void run()
1926
{
27+
//REMOVE_START
28+
// This is needed because we're constructing ConfigurationOptions in the test before calling GetConnection
29+
SkipIfTargetConnectionDoesNotExist(EndpointsFixture.Env.Standalone);
30+
var _ = GetCleanDatabase(EndpointsFixture.Env.Standalone);
31+
//REMOVE_END
2032
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
2133
var db = muxer.GetDatabase();
2234
//REMOVE_START

tests/Doc/HashExample.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,22 @@ namespace Doc;
99
[Collection("DocsTests")]
1010
//REMOVE_END
1111
public class HashExample
12+
// REMOVE_START
13+
: AbstractNRedisStackTest, IDisposable
14+
// REMOVE_END
1215
{
16+
// REMOVE_START
17+
public HashExample(EndpointsFixture fixture) : base(fixture) { }
1318

19+
[SkippableFact]
20+
// REMOVE_END
1421
public void run()
1522
{
23+
//REMOVE_START
24+
// This is needed because we're constructing ConfigurationOptions in the test before calling GetConnection
25+
SkipIfTargetConnectionDoesNotExist(EndpointsFixture.Env.Standalone);
26+
var _ = GetCleanDatabase(EndpointsFixture.Env.Standalone);
27+
//REMOVE_END
1628
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
1729
var db = muxer.GetDatabase();
1830
db.KeyDelete("bike:1");

0 commit comments

Comments
 (0)