File tree Expand file tree Collapse file tree 5 files changed +125
-0
lines changed Expand file tree Collapse file tree 5 files changed +125
-0
lines changed Original file line number Diff line number Diff line change 99namespace 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 > ( ) ;
Original file line number Diff line number Diff line change 99namespace 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 > ( ) ;
Original file line number Diff line number Diff line change 1616namespace 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 > ( ) ;
Original file line number Diff line number Diff 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 > ( ) ;
Original file line number Diff line number Diff line change 99namespace 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 ( ) {
You can’t perform that action at this time.
0 commit comments