|
|
|
@ -0,0 +1,61 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Newtonsoft.Json.Serialization;
|
|
|
|
|
|
|
|
|
|
using StackExchange.Redis;
|
|
|
|
|
using Xunit;
|
|
|
|
|
using Xunit.Extensions;
|
|
|
|
|
using Xunit.Serialization;
|
|
|
|
|
using Xunit.Abstractions;
|
|
|
|
|
using Xunit.Sdk;
|
|
|
|
|
|
|
|
|
|
using RedisStudyModel;
|
|
|
|
|
using RedisStuy;
|
|
|
|
|
|
|
|
|
|
namespace RedisStudyTest
|
|
|
|
|
{
|
|
|
|
|
[Trait("RedisString", "All")]
|
|
|
|
|
public class RedisListStudyTest : IDisposable
|
|
|
|
|
{
|
|
|
|
|
#region 初始化
|
|
|
|
|
private readonly ITestOutputHelper testOutput;
|
|
|
|
|
private IDatabase redisDatabase = null;
|
|
|
|
|
private RedisListStudy redisListStudy = null;
|
|
|
|
|
private TimeSpan defaultExpiry =TimeSpan.FromSeconds(20);
|
|
|
|
|
private string defaultRedisKey = "RedisStudy:List:xUnitTest";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 构造
|
|
|
|
|
/// </summary>
|
|
|
|
|
public RedisListStudyTest(ITestOutputHelper output)
|
|
|
|
|
{
|
|
|
|
|
this.testOutput = output;
|
|
|
|
|
redisDatabase = RedisHelper.GetRedisDatabase();
|
|
|
|
|
redisListStudy = new RedisListStudy();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region
|
|
|
|
|
[Fact]
|
|
|
|
|
public void ListLeftPushTest()
|
|
|
|
|
{
|
|
|
|
|
var listLength = redisListStudy.ListLeftPush(defaultRedisKey, "first");
|
|
|
|
|
Assert.Equal(1, listLength);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 清理
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
redisDatabase.KeyDelete(defaultRedisKey);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|