mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:22:57 +08:00
Update user test case
This commit is contained in:
parent
6a644cc7dd
commit
1ca78549f3
@ -26,6 +26,11 @@ namespace OrmTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
var data = db.Queryable<UnitCustomeradfafas>().First();
|
||||||
|
if (data.Name != "name" || data.Address.City != "city")
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
db.Updateable(new UnitCustomeradfafas()
|
db.Updateable(new UnitCustomeradfafas()
|
||||||
{
|
{
|
||||||
CustomerId = 1,
|
CustomerId = 1,
|
||||||
@ -38,15 +43,66 @@ namespace OrmTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
}).ExecuteCommand();
|
}).ExecuteCommand();
|
||||||
|
|
||||||
|
data = db.Queryable<UnitCustomeradfafas>().First();
|
||||||
|
if (data.Name != "name2" || data.Address.City != "city2")
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
|
|
||||||
var list = db.Queryable<UnitCustomeradfafas>().ToList();
|
var list = db.Queryable<UnitCustomeradfafas>().ToList();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
db.Insertable(new List<UnitCustomeradfafas>(){
|
||||||
|
new UnitCustomeradfafas()
|
||||||
|
{
|
||||||
|
CustomerId = 3,
|
||||||
|
Name = "name3",
|
||||||
|
Address = new UnitAddressadfafa()
|
||||||
|
{
|
||||||
|
City = "city3",
|
||||||
|
Street = "street3",
|
||||||
|
ZipCode = "zipCode3"
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
new UnitCustomeradfafas()
|
||||||
|
{
|
||||||
|
CustomerId = 4,
|
||||||
|
Name = "name4",
|
||||||
|
Address = new UnitAddressadfafa()
|
||||||
|
{
|
||||||
|
City = "city4",
|
||||||
|
Street = "street4",
|
||||||
|
ZipCode = "zipCode4"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}).ExecuteCommand();
|
||||||
|
|
||||||
var list2 = db.Queryable<UnitCustomeradfafas>()
|
var list2 = db.Queryable<UnitCustomeradfafas>()
|
||||||
.Where(it => it.Address.City == "city2")
|
.Where(it => it.Address.City == "city2")
|
||||||
.Select(it=>new {
|
.Select(it => new
|
||||||
|
{
|
||||||
Street = it.Address.Street
|
Street = it.Address.Street
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
if (list2.Single().Street != "street2")
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (db.Queryable<UnitCustomeradfafas>().Count() != 3)
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
|
var list3=db.Queryable<UnitCustomeradfafas>().ToList();
|
||||||
|
data = list3.Last();
|
||||||
|
if (data.Name != "name4" || data.Address.City != "city4")
|
||||||
|
{
|
||||||
|
throw new Exception("unit error");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class UnitAddressadfafa
|
public class UnitAddressadfafa
|
||||||
|
Loading…
Reference in New Issue
Block a user