增加microsoft.data.core的测试项目

This commit is contained in:
luoyunchong
2021-12-24 21:02:05 +08:00
parent e6e0a1275c
commit fdfb8a9cb4
25 changed files with 10462 additions and 0 deletions

View File

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using Xunit;
namespace FreeSql.Tests.Sqlite
{
public class SqliteAopTest
{
class TestAuditValue
{
public Guid id { get; set; }
[Now]
public DateTime createtime { get; set; }
}
class NowAttribute: Attribute { }
[Fact]
public void AuditValue()
{
var date = DateTime.Now.Date;
var item = new TestAuditValue();
EventHandler<Aop.AuditValueEventArgs> audit = (s, e) =>
{
if (e.Property.GetCustomAttribute<NowAttribute>(false) != null)
e.Value = DateTime.Now.Date;
};
g.sqlite.Aop.AuditValue += audit;
g.sqlite.Insert(item).ExecuteAffrows();
g.sqlite.Aop.AuditValue -= audit;
Assert.Equal(item.createtime, date);
}
}
}