Browse Source

Add unit test

SqlSugar5
sunkaixuan 2 years ago
parent
commit
5399ad3527
  1. 26
      Src/Asp.Net/SqlServerTest/UnitTest/UCustom024.cs

26
Src/Asp.Net/SqlServerTest/UnitTest/UCustom024.cs

@ -21,7 +21,33 @@ namespace OrmTest
db.Queryable<Order>().Where(z => z.Id != p.Id).ToList();
var p2 = new Order();
db.Queryable<Order>().Where(z => z.Id != p2.Id).ToList();
db.CurrentConnectionConfig.ConfigureExternalServices = new SqlSugar.ConfigureExternalServices()
{
SqlFuncServices=new List<SqlSugar.SqlFuncExternal>()
{
new SqlSugar.SqlFuncExternal()
{
UniqueMethodName = "MyToString",
MethodValue = (expInfo, dbType, expContext) =>
{
return "1";
}
}
}
};
var sql2= db.Queryable<Order>()
.Select(it => new
{
name= MyToString()
}).ToSql();
if (sql2.Key != "SELECT 1 AS name FROM [Order] ")
{
throw new Exception("unit error");
}
}
public static object MyToString() { return null; }
}

Loading…
Cancel
Save