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

+12
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

+12
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

+13
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

+12
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

+12
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

+12
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

+12
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

+12
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

+12
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

+12
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");

tests/Doc/Hll_tutorial.cs

+12
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,22 @@ namespace Doc;
1313

1414
// HIDE_START
1515
public class Hll_tutorial
16+
// REMOVE_START
17+
: AbstractNRedisStackTest, IDisposable
18+
// REMOVE_END
1619
{
20+
// REMOVE_START
21+
public Hll_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/HomeJsonExample.cs

+13
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,23 @@ namespace Doc;
1717

1818
// HIDE_START
1919
public class HomeJsonExample
20+
// REMOVE_START
21+
: AbstractNRedisStackTest, IDisposable
22+
// REMOVE_END
2023
{
24+
// REMOVE_START
25+
public HomeJsonExample(EndpointsFixture fixture) : base(fixture) { }
2126

27+
[SkippableFact]
28+
// REMOVE_END
2229
public void run()
2330
{
31+
//REMOVE_START
32+
// This is needed because we're constructing ConfigurationOptions in the test before calling GetConnection
33+
SkipIfTargetConnectionDoesNotExist(EndpointsFixture.Env.Standalone);
34+
var _ = GetCleanDatabase(EndpointsFixture.Env.Standalone);
35+
//REMOVE_END
36+
2437
// STEP_START connect
2538
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
2639
var db = muxer.GetDatabase();

tests/Doc/Json_tutorial.cs

+12
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,22 @@ namespace Doc;
1515

1616
// HIDE_START
1717
public class Json_tutorial
18+
// REMOVE_START
19+
: AbstractNRedisStackTest, IDisposable
20+
// REMOVE_END
1821
{
22+
// REMOVE_START
23+
public Json_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/ListTutorial.cs

+13
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,22 @@ namespace Doc;
1212
[Collection("DocsTests")]
1313
//REMOVE_END
1414
public class ListExample
15+
// REMOVE_START
16+
: AbstractNRedisStackTest, IDisposable
17+
// REMOVE_END
1518
{
19+
// REMOVE_START
20+
public ListExample(EndpointsFixture fixture) : base(fixture) { }
21+
22+
[SkippableFact]
23+
// REMOVE_END
1624
public void run()
1725
{
26+
//REMOVE_START
27+
// This is needed because we're constructing ConfigurationOptions in the test before calling GetConnection
28+
SkipIfTargetConnectionDoesNotExist(EndpointsFixture.Env.Standalone);
29+
var _ = GetCleanDatabase(EndpointsFixture.Env.Standalone);
30+
//REMOVE_END
1831
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
1932
var db = muxer.GetDatabase();
2033
//HIDE_END

tests/Doc/QueryAggExample.cs

+12
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,22 @@ namespace Doc;
1717

1818
// HIDE_START
1919
public class QueryAggExample
20+
// REMOVE_START
21+
: AbstractNRedisStackTest, IDisposable
22+
// REMOVE_END
2023
{
24+
// REMOVE_START
25+
public QueryAggExample(EndpointsFixture fixture) : base(fixture) { }
2126

27+
[SkippableFact]
28+
// REMOVE_END
2229
public void run()
2330
{
31+
//REMOVE_START
32+
// This is needed because we're constructing ConfigurationOptions in the test before calling GetConnection
33+
SkipIfTargetConnectionDoesNotExist(EndpointsFixture.Env.Standalone);
34+
var _ = GetCleanDatabase(EndpointsFixture.Env.Standalone);
35+
//REMOVE_END
2436
var muxer = ConnectionMultiplexer.Connect("localhost:6379");
2537
var db = muxer.GetDatabase();
2638
//REMOVE_START

tests/Doc/QueryEmExample.cs

+12
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,22 @@ namespace Doc;
1616

1717
// HIDE_START
1818
public class QueryEmExample
19+
// REMOVE_START
20+
: AbstractNRedisStackTest, IDisposable
21+
// REMOVE_END
1922
{
23+
// REMOVE_START
24+
public QueryEmExample(EndpointsFixture fixture) : base(fixture) { }
2025

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

tests/Doc/QueryFtExample.cs

+12
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,22 @@ namespace Doc;
1616

1717
// HIDE_START
1818
public class QueryFtExample
19+
// REMOVE_START
20+
: AbstractNRedisStackTest, IDisposable
21+
// REMOVE_END
1922
{
23+
// REMOVE_START
24+
public QueryFtExample(EndpointsFixture fixture) : base(fixture) { }
2025

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

0 commit comments

Comments
 (0)