|
|
@ -325,6 +325,43 @@ namespace RedisStudyTest
|
|
|
|
|
|
|
|
|
|
|
|
Assert.False(result.HasValue);
|
|
|
|
Assert.False(result.HasValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
|
|
public void StringGetTest()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
redisStringStudy.StringSet(defaultRedisKey, "wanggaofeng", defaultExpiry);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var getValue = redisStringStudy.StringGet(defaultRedisKey);
|
|
|
|
|
|
|
|
Assert.Equal("wanggaofeng",getValue);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
|
|
public void StringGetGroupTest()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
RedisKey[] keys = new RedisKey[]
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"RedisStudy:String:xUnitTest1",
|
|
|
|
|
|
|
|
"RedisStudy:String:xUnitTest2"
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
RedisValue[] values = new RedisValue[]
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"wanggaofeng",
|
|
|
|
|
|
|
|
"王高峰",
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KeyValuePair<RedisKey,RedisValue>[] pairs=new KeyValuePair<RedisKey, RedisValue>[]
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
new KeyValuePair<RedisKey,RedisValue>(keys[0],values[0]),
|
|
|
|
|
|
|
|
new KeyValuePair<RedisKey,RedisValue>(keys[1],values[1]),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
redisStringStudy.StringSet(pairs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var getValus = redisStringStudy.StringGet(keys);
|
|
|
|
|
|
|
|
Assert.Contains(values[0], getValus);
|
|
|
|
|
|
|
|
Assert.Contains(values[1], getValus);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region StringGetRange
|
|
|
|
#region StringGetRange
|
|
|
@ -372,6 +409,21 @@ namespace RedisStudyTest
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region StringLength
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
|
|
public void StringLengthTest()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var length = redisStringStudy.StringLength(defaultRedisKey);
|
|
|
|
|
|
|
|
Assert.Equal(0,length);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
redisStringStudy.StringSet(defaultRedisKey, "wanggaofeng", defaultExpiry);
|
|
|
|
|
|
|
|
length = redisStringStudy.StringLength(defaultRedisKey);
|
|
|
|
|
|
|
|
Assert.Equal("wanggaofeng".Length, length);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 清理
|
|
|
|
#region 清理
|
|
|
|
public void Dispose()
|
|
|
|
public void Dispose()
|
|
|
|
{
|
|
|
|
{
|
|
|
|