Browse Source

Update Demo

pull/12/MERGE
sunkaixuan 6 years ago
parent
commit
d5a0618e26
  1. 1
      Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
  2. 19
      Src/Asp.Net/SqlServerTest/UnitTest/ObjectsValidate.cs
  3. 2
      Src/Asp.Net/SqlServerTest/UnitTest/UJson.cs

1
Src/Asp.Net/SqlServerTest/SqlServerTest.csproj

@ -140,6 +140,7 @@
<Compile Include="OldTest\UnitTest\Setting\MapColumn.cs" />
<Compile Include="OldTest\UnitTest\Setting\MapTable.cs" />
<Compile Include="OldTest\UnitTest\Update.cs" />
<Compile Include="UnitTest\ObjectsValidate.cs" />
<Compile Include="UnitTest\UJson.cs" />
<Compile Include="UnitTest\Main.cs" />
</ItemGroup>

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

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
public class ObjectsValidate
{
public static void Check(object a ,object b,object name)
{
if (a?.ToString() != b?.ToString())
{
new Exception(name+" error");
}
}
}
}

2
Src/Asp.Net/SqlServerTest/UnitTest/UJson.cs

@ -15,7 +15,9 @@ namespace OrmTest
Db.DbMaintenance.TruncateTable<JsonTest>();
Db.Insertable(new JsonTest() { Order = new Order { Id = 1, Name = "order1" } }).ExecuteCommand();
var list = Db.Queryable<JsonTest>().ToList();
ObjectsValidate.Check("order1", list.First().Order.Name, "Json");
Db.Updateable(new JsonTest() { Id = 1, Order = new Order { Id = 2, Name = "order2" } }).ExecuteCommand();
ObjectsValidate.Check("order2", list.First().Order.Name, "Json");
var list2 = Db.Queryable<JsonTest>().ToList();
}
}

Loading…
Cancel
Save