Browse Source

Add unit test

SqlSugar5
sunkaixuan 2 years ago
parent
commit
87c4bf46c5
  1. 19
      Src/Asp.Net/SqlServerTest/UnitTest/UCustom20.cs

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

@ -88,6 +88,25 @@ namespace OrmTest
{
throw new Exception("unit error");
}
var list = db.Queryable<Order>().ToList();
var test7 = db.Queryable<Order>()
.LeftJoin<Order>((x,y)=>x.Id==y.Id)
.Take(2)
.Select((x,y) => new TestDTO
{
SubOne = new TestSubDTO { NameOne = x.Name, NameTwo = x.Name },
SubTwo = new TestSubDTO { NameOne = x.Name, NameTwo = x.Name }
})
.ToList() ;
if (test7.First().SubTwo.NameTwo != "jack"|| test7.First().SubTwo.NameOne != "jack")
{
throw new Exception("unit error");
}
if (test7.First().SubOne.NameTwo != "jack" || test7.First().SubOne.NameOne != "jack")
{
throw new Exception("unit error");
}
}
public class TestDTO

Loading…
Cancel
Save