You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.5 KiB
C#
62 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Xunit;
|
|
using Xunit.Extensions;
|
|
using Xunit.Abstractions;
|
|
using Xunit.Sdk;
|
|
using StackExchange;
|
|
using StackExchange.Redis;
|
|
|
|
using RedisStuy;
|
|
using Moq;
|
|
|
|
namespace RedisStudyTest
|
|
{
|
|
public class RedisHelperTest
|
|
{
|
|
[Fact]
|
|
public void MyTest()
|
|
{
|
|
Assert.True(1 < 99);
|
|
}
|
|
|
|
[Fact]
|
|
public void GetRedisDatabaseTest()
|
|
{
|
|
var db= RedisHelper.GetRedisDatabase();
|
|
|
|
Assert.True(db != null);
|
|
Assert.Contains("127.0.0.1", db.Multiplexer.Configuration);
|
|
Assert.Equal(1, db.Database);
|
|
}
|
|
|
|
[Fact]
|
|
public void GetRedisDatabaseTest2()
|
|
{
|
|
//ConfigurationOptions options = new ConfigurationOptions();
|
|
//options.DefaultDatabase = 1;
|
|
//options.EndPoints.Add("127.0.0.1", 6379);
|
|
|
|
//IConnectionMultiplexer connection = ConnectionMultiplexer.Connect(options);
|
|
|
|
//var mock = new Mock<IConnectionMultiplexer>(options);
|
|
////mock.Setup(a => a.GetDatabase(1)).Returns(IDatabase);
|
|
|
|
|
|
//var myDB = mock.Object;
|
|
////Assert.Equal("127.0.0.1", myDB.Multiplexer.Configuration);
|
|
}
|
|
|
|
[Fact]
|
|
public void GetServerTest()
|
|
{
|
|
var redisServer = RedisHelper.GetDefaultRedisServer();
|
|
|
|
Assert.NotNull(redisServer);
|
|
}
|
|
}
|
|
}
|