Skip to content

Commit b05c4f6

Browse files
2881028810
authored andcommitted
增加 中文表_字段 的单元测试
1 parent b61dfbb commit b05c4f6

File tree

5 files changed

+125
-0
lines changed

5 files changed

+125
-0
lines changed

FreeSql.Tests/MySql/MySqlCodeFirstTest.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,31 @@
99
namespace FreeSql.Tests.MySql {
1010
public class MySqlCodeFirstTest {
1111

12+
[Fact]
13+
public void 中文表_字段() {
14+
var sql = g.mysql.CodeFirst.GetComparisonDDLStatements<测试中文表>();
15+
g.mysql.CodeFirst.SyncStructure<测试中文表>();
16+
17+
var item = new 测试中文表 {
18+
标题 = "测试标题",
19+
创建时间 = DateTime.Now
20+
};
21+
Assert.Equal(1, g.mysql.Insert<测试中文表>().AppendData(item).ExecuteAffrows());
22+
Assert.NotEqual(Guid.Empty, item.编号);
23+
var item2 = g.mysql.Select<测试中文表>().Where(a => a.编号 == item.编号).First();
24+
Assert.NotNull(item2);
25+
Assert.Equal(item.编号, item2.编号);
26+
Assert.Equal(item.标题, item2.标题);
27+
}
28+
class 测试中文表 {
29+
[Column(IsPrimary = true)]
30+
public Guid 编号 { get; set; }
31+
32+
public string 标题 { get; set; }
33+
34+
public DateTime 创建时间 { get; set; }
35+
}
36+
1237
[Fact]
1338
public void AddUniques() {
1439
var sql = g.mysql.CodeFirst.GetComparisonDDLStatements<AddUniquesInfo>();

FreeSql.Tests/Oracle/OracleCodeFirstTest.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,31 @@
99
namespace FreeSql.Tests.Oracle {
1010
public class OracleCodeFirstTest {
1111

12+
[Fact]
13+
public void 中文表_字段() {
14+
var sql = g.oracle.CodeFirst.GetComparisonDDLStatements<测试中文表>();
15+
g.oracle.CodeFirst.SyncStructure<测试中文表>();
16+
17+
var item = new 测试中文表 {
18+
标题 = "测试标题",
19+
创建时间 = DateTime.Now
20+
};
21+
Assert.Equal(1, g.oracle.Insert<测试中文表>().AppendData(item).ExecuteAffrows());
22+
Assert.NotEqual(Guid.Empty, item.编号);
23+
var item2 = g.oracle.Select<测试中文表>().Where(a => a.编号 == item.编号).First();
24+
Assert.NotNull(item2);
25+
Assert.Equal(item.编号, item2.编号);
26+
Assert.Equal(item.标题, item2.标题);
27+
}
28+
class 测试中文表 {
29+
[Column(IsPrimary = true)]
30+
public Guid 编号 { get; set; }
31+
32+
public string 标题 { get; set; }
33+
34+
public DateTime 创建时间 { get; set; }
35+
}
36+
1237
[Fact]
1338
public void AddUniques() {
1439
var sql = g.oracle.CodeFirst.GetComparisonDDLStatements<AddUniquesInfo>();

FreeSql.Tests/PostgreSQL/PostgreSQLCodeFirstTest.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,31 @@
1616
namespace FreeSql.Tests.PostgreSQL {
1717
public class PostgreSQLCodeFirstTest {
1818

19+
[Fact]
20+
public void 中文表_字段() {
21+
var sql = g.pgsql.CodeFirst.GetComparisonDDLStatements<测试中文表>();
22+
g.pgsql.CodeFirst.SyncStructure<测试中文表>();
23+
24+
var item = new 测试中文表 {
25+
标题 = "测试标题",
26+
创建时间 = DateTime.Now
27+
};
28+
Assert.Equal(1, g.pgsql.Insert<测试中文表>().AppendData(item).ExecuteAffrows());
29+
Assert.NotEqual(Guid.Empty, item.编号);
30+
var item2 = g.pgsql.Select<测试中文表>().Where(a => a.编号 == item.编号).First();
31+
Assert.NotNull(item2);
32+
Assert.Equal(item.编号, item2.编号);
33+
Assert.Equal(item.标题, item2.标题);
34+
}
35+
class 测试中文表 {
36+
[Column(IsPrimary = true)]
37+
public Guid 编号 { get; set; }
38+
39+
public string 标题 { get; set; }
40+
41+
public DateTime 创建时间 { get; set; }
42+
}
43+
1944
[Fact]
2045
public void AddUniques() {
2146
var sql = g.pgsql.CodeFirst.GetComparisonDDLStatements<AddUniquesInfo>();

FreeSql.Tests/SqlServer/SqlServerCodeFirstTest.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,32 @@ public SqlServerCodeFirstTest(SqlServerFixture sqlserverFixture)
1919
_sqlserverFixture = sqlserverFixture;
2020
}
2121

22+
[Fact]
23+
public void 中文表_字段() {
24+
var sql = _sqlserverFixture.SqlServer.CodeFirst.GetComparisonDDLStatements<测试中文表>();
25+
_sqlserverFixture.SqlServer.CodeFirst.SyncStructure<测试中文表>();
26+
27+
var item = new 测试中文表 {
28+
标题 = "测试标题",
29+
创建时间 = DateTime.Now
30+
};
31+
Assert.Equal(1, _sqlserverFixture.SqlServer.Insert<测试中文表>().AppendData(item).ExecuteAffrows());
32+
Assert.NotEqual(Guid.Empty, item.编号);
33+
var item2 = _sqlserverFixture.SqlServer.Select<测试中文表>().Where(a => a.编号 == item.编号).First();
34+
Assert.NotNull(item2);
35+
Assert.Equal(item.编号, item2.编号);
36+
Assert.Equal(item.标题, item2.标题);
37+
}
38+
class 测试中文表 {
39+
[Column(IsPrimary = true)]
40+
public Guid 编号 { get; set; }
41+
42+
public string 标题 { get; set; }
43+
44+
public DateTime 创建时间 { get; set; }
45+
}
46+
47+
2248
[Fact]
2349
public void AddUniques() {
2450
var sql = _sqlserverFixture.SqlServer.CodeFirst.GetComparisonDDLStatements<AddUniquesInfo>();

FreeSql.Tests/Sqlite/SqliteCodeFirstTest.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,30 @@
99
namespace FreeSql.Tests.Sqlite {
1010
public class SqliteCodeFirstTest {
1111

12+
[Fact]
13+
public void 中文表_字段() {
14+
var sql = g.sqlite.CodeFirst.GetComparisonDDLStatements<测试中文表>();
15+
g.sqlite.CodeFirst.SyncStructure<测试中文表>();
16+
17+
var item = new 测试中文表 {
18+
标题 = "测试标题",
19+
创建时间 = DateTime.Now
20+
};
21+
Assert.Equal(1, g.sqlite.Insert<测试中文表>().AppendData(item).ExecuteAffrows());
22+
Assert.NotEqual(Guid.Empty, item.编号);
23+
var item2 = g.sqlite.Select<测试中文表>().Where(a => a.编号 == item.编号).First();
24+
Assert.NotNull(item2);
25+
Assert.Equal(item.编号, item2.编号);
26+
Assert.Equal(item.标题, item2.标题);
27+
}
28+
class 测试中文表 {
29+
[Column(IsPrimary = true)]
30+
public Guid 编号 { get; set; }
31+
32+
public string 标题 { get; set; }
33+
34+
public DateTime 创建时间 { get; set; }
35+
}
1236

1337
[Fact]
1438
public void AddUniques() {

0 commit comments

Comments
 (0)