2019-05-01 11:36:24 +08:00
|
|
|
|
using Longbow.Web.Mvc;
|
|
|
|
|
using Xunit;
|
2019-01-11 23:20:28 +08:00
|
|
|
|
|
2019-05-15 00:22:13 +08:00
|
|
|
|
namespace Bootstrap.DataAccess.SqlServer
|
2019-01-11 23:20:28 +08:00
|
|
|
|
{
|
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 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-06-01 16:57:33 +08:00
|
|
|
|
Assert.True(LogHelper.Save(log));
|
2019-05-25 14:52:14 +08:00
|
|
|
|
Assert.NotNull(LogHelper.RetrievePages(new PaginationOption() { Limit = 20, Sort = "LogTime", Order = "desc" }, null, null, null));
|
|
|
|
|
Assert.NotNull(LogHelper.RetrievePages(new PaginationOption() { Limit = 20, Sort = "CRUD", Order = "desc" }, null, null, null));
|
|
|
|
|
Assert.NotNull(LogHelper.RetrievePages(new PaginationOption() { Limit = 20, Sort = "UserName", Order = "desc" }, null, null, null));
|
|
|
|
|
Assert.NotNull(LogHelper.RetrievePages(new PaginationOption() { Limit = 20, Sort = "Ip", Order = "desc" }, null, null, null));
|
|
|
|
|
Assert.NotNull(LogHelper.RetrievePages(new PaginationOption() { Limit = 20, Sort = "RequestUrl", Order = "desc" }, null, null, null));
|
|
|
|
|
Assert.NotEmpty(LogHelper.RetrieveAll(null, null, null));
|
2019-01-11 23:20:28 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|