From e437d7590218a826838f4c73c9b4c5cb791edcf4 Mon Sep 17 00:00:00 2001 From: ruyu Date: Mon, 9 Jul 2018 22:07:21 +0800 Subject: [PATCH] develep --- RedisStudyTest/RedisSortedSetStudyTest.cs | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/RedisStudyTest/RedisSortedSetStudyTest.cs b/RedisStudyTest/RedisSortedSetStudyTest.cs index 58067f7..6ea9363 100644 --- a/RedisStudyTest/RedisSortedSetStudyTest.cs +++ b/RedisStudyTest/RedisSortedSetStudyTest.cs @@ -530,7 +530,44 @@ namespace RedisStudyTest [Fact] public void SortedSetRangeByValue_Page_Test() { + SortedSetEntry[] sortedSetEntries = new SortedSetEntry[] + { + new SortedSetEntry("Andy",0), + new SortedSetEntry("and",0), + new SortedSetEntry("And",0), + new SortedSetEntry("Banana",0), + new SortedSetEntry("color",0), + new SortedSetEntry("query",0), + new SortedSetEntry("remove",0), + new SortedSetEntry("101",0), + new SortedSetEntry("304",0), + new SortedSetEntry("404",0), + new SortedSetEntry("王高峰",0), + new SortedSetEntry("刘山东",0), + }; + redisSortedSetStudy.SortedSetAdd(defaultRedisKey, sortedSetEntries); + + //第一页 + var members = redisSortedSetStudy.SortedSetRangeByValue(defaultRedisKey, "101", "remove", Exclude.None, 0, 4, CommandFlags.None); + Assert.Equal(4, members.Length); + Assert.Contains("101", members); + Assert.Contains("304", members); + Assert.Contains("404", members); + Assert.Contains("And", members); + //第2页 + members = redisSortedSetStudy.SortedSetRangeByValue(defaultRedisKey, "101", "remove", Exclude.None, 4, 4, CommandFlags.None); + Assert.Equal(4, members.Length); + Assert.Contains("Andy", members); + Assert.Contains("Banana", members); + Assert.Contains("and", members); + Assert.Contains("color", members); + + //第3页 + members = redisSortedSetStudy.SortedSetRangeByValue(defaultRedisKey, "101", "remove", Exclude.None, 8, 4, CommandFlags.None); + Assert.Equal(2, members.Length); + Assert.Contains("query", members); + Assert.Contains("remove", members); } #endregion