BootstrapAdmin/UnitTest/Bootstrap.DataAccess/LogsTest.cs

43 lines
1.1 KiB
C#
Raw Normal View History

using Longbow.Web.Mvc;
using Xunit;
namespace Bootstrap.DataAccess
{
[Collection("SQLServerContext")]
public class LogsTest
{
[Fact]
public void Save_Ok()
{
var log = new Log()
{
UserName = "UnitTest",
Browser = "UnitTest",
City = "本地连接",
OS = "UnitTest",
Ip = "::1",
CRUD = "UnitTest",
RequestUrl = "~/Home/Index"
};
Assert.True(LogHelper.Save(log));
}
[Fact]
public void Retrieves_Ok()
{
var log = new Log()
{
UserName = "UnitTest",
Browser = "UnitTest",
City = "本地连接",
OS = "UnitTest",
Ip = "::1",
CRUD = "UnitTest",
RequestUrl = "~/Home/Index"
};
LogHelper.Save(log);
Assert.NotNull(LogHelper.Retrieves(new PaginationOption() { Limit = 20, Order = "LogTime" }, null, null, null));
}
}
}