2019-01-11 23:20:28 +08:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
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",
|
|
|
|
|
Ip = "::",
|
2019-01-11 23:20:28 +08:00
|
|
|
|
CRUD = "UnitTest",
|
|
|
|
|
RequestUrl = "~/Home/Index"
|
|
|
|
|
};
|
|
|
|
|
Assert.True(log.Save(log));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[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",
|
|
|
|
|
Ip = "::",
|
2019-01-12 19:23:10 +08:00
|
|
|
|
CRUD = "UnitTest",
|
|
|
|
|
RequestUrl = "~/Home/Index"
|
|
|
|
|
};
|
|
|
|
|
log.Save(log);
|
2019-01-11 23:20:28 +08:00
|
|
|
|
Assert.NotEmpty(log.Retrieves());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|