Add unit test

This commit is contained in:
sunkaixuan 2022-12-11 20:09:41 +08:00
parent 638d12309a
commit 3cf634eb62

View File

@ -31,9 +31,32 @@ namespace OrmTest
enumType = x.enumType , enumType = x.enumType ,
SerialNo = x.SerialNo SerialNo = x.SerialNo
}).ToList(); }).ToList();
db.Aop.OnLogExecuting = (s, p) => Console.WriteLine(s);
db.CurrentConnectionConfig.MoreSettings = new ConnMoreSettings()
{
IsAutoToUpper = false
};
db.CodeFirst.InitTables<CodeFirstNoUpper>();
db.Insertable(new CodeFirstNoUpper() { Id = Guid.NewGuid() + "", Name = "a" }).ExecuteCommand();
var list3 = db.Queryable<CodeFirstNoUpper>().Where(it => it.Id != null).ToList();
db.Updateable(list3).ExecuteCommand();
db.Deleteable(list3).ExecuteCommand();
db.Updateable(list3.First()).ExecuteCommand();
db.Deleteable<CodeFirstNoUpper>().Where(it => it.Id != null).ExecuteCommand();
db.Updateable<CodeFirstNoUpper>().SetColumns(it => it.Name == "a").Where(it => it.Id != null).ExecuteCommand();
db.Updateable<CodeFirstNoUpper>().SetColumns(it => new CodeFirstNoUpper()
{
Name = "a"
}).Where(it => it.Id != null).ExecuteCommand();
Console.WriteLine("#### CodeFirst end ####"); Console.WriteLine("#### CodeFirst end ####");
} }
} }
public class CodeFirstNoUpper
{
[SugarColumn(IsPrimaryKey = true)]
public string Id { get; set; }
public string Name { get; set; }
}
public class EnumTypeClass public class EnumTypeClass
{ {