|
|
|
@ -166,6 +166,67 @@ namespace RedisStudyTest
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region MyRegion
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void SortedSetLength_NotKey_Test()
|
|
|
|
|
{
|
|
|
|
|
var memberCount = redisSortedSetStudy.SortedSetLength(defaultRedisKey);
|
|
|
|
|
Assert.Equal(0, memberCount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 排它性参数Exclude设置 测试
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Fact]
|
|
|
|
|
public void SortedSetLength_Exclude_Test()
|
|
|
|
|
{
|
|
|
|
|
SortedSetEntry[] sortedSetEntries = new SortedSetEntry[]
|
|
|
|
|
{
|
|
|
|
|
new SortedSetEntry("first",1),
|
|
|
|
|
new SortedSetEntry("second",2),
|
|
|
|
|
new SortedSetEntry("third",3),
|
|
|
|
|
new SortedSetEntry("four",4),
|
|
|
|
|
new SortedSetEntry("five",5),
|
|
|
|
|
};
|
|
|
|
|
redisSortedSetStudy.SortedSetAdd(defaultRedisKey, sortedSetEntries);
|
|
|
|
|
|
|
|
|
|
//默认:Exclude.None [Start,Stop]
|
|
|
|
|
var memberCount = redisSortedSetStudy.SortedSetLength(defaultRedisKey, 2, 4, Exclude.None, CommandFlags.None);
|
|
|
|
|
Assert.Equal(3, memberCount);
|
|
|
|
|
|
|
|
|
|
//Exclude.Start (Start,Stop]
|
|
|
|
|
memberCount = redisSortedSetStudy.SortedSetLength(defaultRedisKey, 2, 4, Exclude.Start, CommandFlags.None);
|
|
|
|
|
Assert.Equal(2, memberCount);
|
|
|
|
|
|
|
|
|
|
//Exclude.Stop [Start,Stop)
|
|
|
|
|
memberCount = redisSortedSetStudy.SortedSetLength(defaultRedisKey, 2, 4, Exclude.Stop, CommandFlags.None);
|
|
|
|
|
Assert.Equal(2, memberCount);
|
|
|
|
|
|
|
|
|
|
//Exclude.Both (Start,Stop)
|
|
|
|
|
memberCount = redisSortedSetStudy.SortedSetLength(defaultRedisKey, 2, 4, Exclude.Both, CommandFlags.None);
|
|
|
|
|
Assert.Equal(1, memberCount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void SortedSetLengthTest()
|
|
|
|
|
{
|
|
|
|
|
SortedSetEntry[] sortedSetEntries=new SortedSetEntry[]
|
|
|
|
|
{
|
|
|
|
|
new SortedSetEntry("first",1),
|
|
|
|
|
new SortedSetEntry("second",2),
|
|
|
|
|
new SortedSetEntry("third",3),
|
|
|
|
|
new SortedSetEntry("four",4),
|
|
|
|
|
new SortedSetEntry("five",5),
|
|
|
|
|
};
|
|
|
|
|
redisSortedSetStudy.SortedSetAdd(defaultRedisKey, sortedSetEntries);
|
|
|
|
|
|
|
|
|
|
var memberCount = redisSortedSetStudy.SortedSetLength(defaultRedisKey, 1, 5);
|
|
|
|
|
Assert.Equal(sortedSetEntries.Length, memberCount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 清理
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|