Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@
<PackageVersion Include="Microsoft.Azure.StackExchangeRedis" Version="3.2.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="Validation" Version="2.6.68" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.assert" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="Xunit.SkippableFact" Version="1.5.23" />
<PackageVersion Include="xunit.v3" Version="3.0.0" />
<PackageVersion Include="xunit.v3.runner.console" Version="3.0.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.3" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion tests/Doc/Bf_tutorial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class BfTutorial
// REMOVE_START
public BfTutorial(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/Bitmap_tutorial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class BitmapTutorial
// REMOVE_START
public BitmapTutorial(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/CmdsHashExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class CmdsHashExample
// REMOVE_START
public CmdsHashExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/CmdsListExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class CmdsListExample
// REMOVE_START
public CmdsListExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/CmdsSetExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class CmdsSetExample
// REMOVE_START
public CmdsSetExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/CmdsSortedSetExamples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class CmdsSortedSet
// REMOVE_START
public CmdsSortedSet(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/CmdsStringExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class CmdsStringExample
// REMOVE_START
public CmdsStringExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/Cms_tutorial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class CmsTutorial
// REMOVE_START
public CmsTutorial(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/Cuckoo_tutorial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class CuckooTutorial
// REMOVE_START
public CuckooTutorial(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
10 changes: 3 additions & 7 deletions tests/Doc/Doc.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0;net481</TargetFrameworks>
<TargetFrameworks>net8.0;net10.0;net481</TargetFrameworks>
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>

<!-- don't warn about obsolete APIs, or theory with no data -->
<Nowarn>$(Nowarn);CS0612;CS0618</Nowarn>
Expand All @@ -12,16 +13,11 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.v3"/>
<PackageReference Include="xunit.runner.visualstudio" Condition="'$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net481'">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<!-- this is the last version with net6 support -->
<PackageReference Include="xunit.runner.visualstudio" Condition="'$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0'" VersionOverride="3.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="StackExchange.Redis"/>
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/GeoIndexExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class GeoIndexExample
// REMOVE_START
public GeoIndexExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/Geo_tutorial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class GeoTutorial
// REMOVE_START
public GeoTutorial(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/HashExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class HashExample
// REMOVE_START
public HashExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/Hll_tutorial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class HllTutorial
// REMOVE_START
public HllTutorial(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/HomeJsonExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class HomeJsonExample
// REMOVE_START
public HomeJsonExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/HomeProbExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class HomeProbExample
// REMOVE_START
public HomeProbExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/Json_tutorial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class JsonTutorial
// REMOVE_START
public JsonTutorial(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/ListTutorial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class ListExample
// REMOVE_START
public ListExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/PipeTransExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class PipeTransExample
// REMOVE_START
public PipeTransExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/QueryAggExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class QueryAggExample
// REMOVE_START
public QueryAggExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/QueryEmExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class QueryEmExample
// REMOVE_START
public QueryEmExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/QueryFtExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class QueryFtExample
// REMOVE_START
public QueryFtExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/QueryRangeExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class QueryRangeExample
// REMOVE_START
public QueryRangeExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/SearchQuickstartExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class SearchQuickstartExample
// REMOVE_START
public SearchQuickstartExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/SetGetExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class SetGetExample
// REMOVE_START
public SetGetExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/SetsTutorial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class SetsExample
// REMOVE_START
public SetsExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/SortedSetExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SortedSetExample
// REMOVE_START
public SortedSetExample(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/StreamTutorial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class StreamTutorial
// REMOVE_START
public StreamTutorial(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/StringSnippets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class StringSnippets
// REMOVE_START
public StringSnippets(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/Tdigest_tutorial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class TdigestTutorial
// REMOVE_START
public TdigestTutorial(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/TimeSeriesTutorial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class TimeSeriesTutorial
// REMOVE_START
public TimeSeriesTutorial(EndpointsFixture fixture) : base(fixture) { }

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Doc/Topk_tutorial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class TopkTutorial
{
// REMOVE_START

[SkippableFact]
[Fact]
// REMOVE_END
public void Run()
{
Expand Down
3 changes: 1 addition & 2 deletions tests/Doc/Usings.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
global using Xunit;
global using Xunit.Abstractions;

global using FactAttribute = NRedisStack.Tests.FactAttribute;
19 changes: 9 additions & 10 deletions tests/NRedisStack.Tests/AbstractNRedisStackTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Runtime.CompilerServices;
using StackExchange.Redis;
using Xunit;
using Xunit.Abstractions;

namespace NRedisStack.Tests;

Expand Down Expand Up @@ -31,20 +30,20 @@ protected internal AbstractNRedisStackTest(EndpointsFixture endpointsFixture, IT
this.log = log;
}

protected ConnectionMultiplexer GetConnection(string endpointId = EndpointsFixture.Env.Standalone) => EndpointsFixture.GetConnectionById(this.DefaultConnectionConfig, endpointId);
protected ConnectionMultiplexer GetConnection(string endpointId = EndpointsFixture.Env.Standalone, bool shareConnection = true) => EndpointsFixture.GetConnectionById(this.DefaultConnectionConfig, endpointId, shareConnection);

protected ConnectionMultiplexer GetConnection(ConfigurationOptions configurationOptions, string endpointId = EndpointsFixture.Env.Standalone) => EndpointsFixture.GetConnectionById(configurationOptions, endpointId);
protected ConnectionMultiplexer GetConnection(ConfigurationOptions configurationOptions, string endpointId = EndpointsFixture.Env.Standalone) => EndpointsFixture.GetConnectionById(configurationOptions, endpointId, false);

protected IDatabase GetDatabase(string endpointId = EndpointsFixture.Env.Standalone)
protected IDatabase GetDatabase(string endpointId = EndpointsFixture.Env.Standalone, bool shareConnection = true)
{
var redis = GetConnection(endpointId);
var redis = GetConnection(endpointId, shareConnection);
IDatabase db = redis.GetDatabase();
return db;
}

protected IDatabase GetCleanDatabase(string endpointId = EndpointsFixture.Env.Standalone)
protected IDatabase GetCleanDatabase(string endpointId = EndpointsFixture.Env.Standalone, bool shareConnection = true)
{
var redis = GetConnection(endpointId);
var redis = GetConnection(endpointId, shareConnection);

if (endpointId == EndpointsFixture.Env.Cluster)
{
Expand All @@ -65,7 +64,7 @@ protected IDatabase GetCleanDatabase(string endpointId = EndpointsFixture.Env.St

protected void SkipIfTargetConnectionDoesNotExist(string id)
{
Skip.IfNot(EndpointsFixture.IsTargetConnectionExist(id), $"The connection with id '{id}' is not configured.");
Assert.SkipUnless(EndpointsFixture.IsTargetConnectionExist(id), $"The connection with id '{id}' is not configured.");
}

private List<string> keyNames = [];
Expand Down Expand Up @@ -98,14 +97,14 @@ protected internal static List<TimeSeriesTuple> ReverseData(List<TimeSeriesTuple
return tuples;
}

public Task InitializeAsync() => Task.CompletedTask;
public ValueTask InitializeAsync() => default;

public void Dispose()
{
//Redis.GetDatabase().ExecuteBroadcast("FLUSHALL");
}

public Task DisposeAsync() => Task.CompletedTask;
public ValueTask DisposeAsync() => default;
/*{
var redis = Redis.GetDatabase();
await redis.KeyDeleteAsync(keyNames.Select(i => (RedisKey)i).ToArray());
Expand Down
Loading
Loading