Browse Source

Add unit test & demo

pull/25/head
sunkaixuan 2 years ago
parent
commit
0e2fcd0967
  1. 5
      Src/Asp.Net/MySqlTest/Demo/Demo1_Queryable.cs
  2. 19
      Src/Asp.Net/SqlServerTest/UnitTest/UCustom22.cs

5
Src/Asp.Net/MySqlTest/Demo/Demo1_Queryable.cs

@ -96,6 +96,11 @@ namespace OrmTest
})
.ToList();
var test04 = db.Queryable<Order>().Where(z => SqlFunc.DateIsSame(z.CreateTime, DateTime.Now, DateType.Weekday)).ToList();
var test08= db.Queryable<Order>().Select(it => new
{
names = $"as{it.Id}fd{it.Id}a"
})
.ToList();
Console.WriteLine("#### Examples End ####");
}

19
Src/Asp.Net/SqlServerTest/UnitTest/UCustom22.cs

@ -77,7 +77,24 @@ namespace OrmTest
{
throw new Exception("unit error");
}
var list5 = db.Queryable<Order>().Take(10)
.Where(it => $"{it.Id + 1}a" == "2a").Select(it => new Order
{
Name = $"{it.Id + 1}a"
}).ToList();
var list6 = db.Queryable<Order>().Take(10)
.Select(it => new
{
name2=it.Name,
id2=it.Id+1,
Name= $"1{it.Id + 1},ada,{it.Name},fasfaa"
}).ToList();
if (list6.Count > 0 && list6.First().Name!= $"1{list6.First().id2},ada,{list6.First().name2},fasfaa")
{
throw new Exception("unit error");
}
}

Loading…
Cancel
Save