2019-05-01 11:36:24 +08:00
|
|
|
|
using Longbow.Web.Mvc;
|
|
|
|
|
using Xunit;
|
2019-01-11 23:20:28 +08:00
|
|
|
|
|
|
|
|
|
namespace Bootstrap.DataAccess
|
|
|
|
|
{
|
2019-01-24 17:58:06 +08:00
|
|
|
|
[Collection("SQLServerContext")]
|
2019-03-04 16:29:35 +08:00
|
|
|
|
public class LogsTest
|
2019-01-11 23:20:28 +08:00
|
|
|
|
{
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Save_Ok()
|
|
|
|
|
{
|
|
|
|
|
var log = new Log()
|
|
|
|
|
{
|
|
|
|
|
UserName = "UnitTest",
|
2019-03-04 16:29:35 +08:00
|
|
|
|
Browser = "UnitTest",
|
|
|
|
|
City = "本地连接",
|
|
|
|
|
OS = "UnitTest",
|
2019-03-09 19:18:03 +08:00
|
|
|
|
Ip = "::1",
|
2019-01-11 23:20:28 +08:00
|
|
|
|
CRUD = "UnitTest",
|
|
|
|
|
RequestUrl = "~/Home/Index"
|
|
|
|
|
};
|
2019-05-14 15:08:46 +08:00
|
|
|
|
Assert.True(LogHelper.Save(log));
|
2019-01-11 23:20:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Retrieves_Ok()
|
|
|
|
|
{
|
2019-01-12 19:23:10 +08:00
|
|
|
|
var log = new Log()
|
|
|
|
|
{
|
|
|
|
|
UserName = "UnitTest",
|
2019-03-04 16:29:35 +08:00
|
|
|
|
Browser = "UnitTest",
|
|
|
|
|
City = "本地连接",
|
|
|
|
|
OS = "UnitTest",
|
2019-03-09 19:18:03 +08:00
|
|
|
|
Ip = "::1",
|
2019-01-12 19:23:10 +08:00
|
|
|
|
CRUD = "UnitTest",
|
|
|
|
|
RequestUrl = "~/Home/Index"
|
|
|
|
|
};
|
2019-05-14 15:08:46 +08:00
|
|
|
|
LogHelper.Save(log);
|
|
|
|
|
Assert.NotNull(LogHelper.Retrieves(new PaginationOption() { Limit = 20, Order = "LogTime" }, null, null, null));
|
2019-01-11 23:20:28 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|