Commit 6494acf3 authored by Marc Gravell's avatar Marc Gravell

Additional test for ZREVRANGE

parent 9c0adcbd
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StackExchange.Redis.Tests.Issues
{
[TestFixture]
public class SO23949477 : TestBase
{
[Test]
public void Execute()
{
using (var conn = Create())
{
var db = conn.GetDatabase(0);
RedisKey key = Me();
db.KeyDelete(key, CommandFlags.FireAndForget);
db.SortedSetAdd(key, "c", 3, CommandFlags.FireAndForget);
db.SortedSetAdd(key,
new[] {
new SortedSetEntry("a", 1),
new SortedSetEntry("b", 2),
new SortedSetEntry("d", 4),
new SortedSetEntry("e", 5)
}, CommandFlags.FireAndForget);
var pairs = db.SortedSetRangeByScoreWithScores(
key, order: Order.Descending, take: 3);
Assert.AreEqual(3, pairs.Length);
Assert.AreEqual(5, pairs[0].Score);
Assert.AreEqual("e", (string)pairs[0].Element);
Assert.AreEqual(4, pairs[1].Score);
Assert.AreEqual("d", (string)pairs[1].Element);
Assert.AreEqual(3, pairs[2].Score);
Assert.AreEqual("c", (string)pairs[2].Element);
}
}
}
}
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
<Compile Include="Issues\Issue25.cs" /> <Compile Include="Issues\Issue25.cs" />
<Compile Include="Issues\Issue6.cs" /> <Compile Include="Issues\Issue6.cs" />
<Compile Include="Issues\SO22786599.cs" /> <Compile Include="Issues\SO22786599.cs" />
<Compile Include="Issues\SO23949477.cs" />
<Compile Include="Keys.cs" /> <Compile Include="Keys.cs" />
<Compile Include="KeysAndValues.cs" /> <Compile Include="KeysAndValues.cs" />
<Compile Include="Lex.cs" /> <Compile Include="Lex.cs" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment