master
ruyu 7 years ago
parent 5ded611ef8
commit 2f88b03002

@ -372,10 +372,59 @@ namespace RedisStudyTest
#region SortedSetScore
[Fact]
public void SortedSetScore_NotKey_Test()
{
var setScore = redisSortedSetStudy.SortedSetScore(defaultRedisKey,"first");
Assert.False(setScore.HasValue);
}
[Fact]
public void SortedSetScore_NotMember_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);
var setScore = redisSortedSetStudy.SortedSetScore(defaultRedisKey, "mysix");
Assert.False(setScore.HasValue);
}
[Fact]
public void SortedSetScoreTest()
{
//redisSortedSetStudy.SortedSetScore();
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 setScore = redisSortedSetStudy.SortedSetScore(defaultRedisKey, "first");
Assert.Equal(1, setScore);
setScore = redisSortedSetStudy.SortedSetScore(defaultRedisKey, "second");
Assert.Equal(2, setScore);
setScore = redisSortedSetStudy.SortedSetScore(defaultRedisKey, "third");
Assert.Equal(3, setScore);
setScore = redisSortedSetStudy.SortedSetScore(defaultRedisKey, "four");
Assert.Equal(4, setScore);
setScore = redisSortedSetStudy.SortedSetScore(defaultRedisKey, "five");
Assert.Equal(5, setScore);
}
#endregion
@ -957,8 +1006,6 @@ namespace RedisStudyTest
}
#endregion
#region 清理
public void Dispose()
{

Loading…
Cancel
Save