File tree Expand file tree Collapse file tree 1 file changed +73
-0
lines changed
FreeSql.Tests/FreeSql.Tests.Provider.TDengine/TDengine/TDengineIssue Expand file tree Collapse file tree 1 file changed +73
-0
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Text ;
5+ using System . Threading . Tasks ;
6+ using FreeSql . DataAnnotations ;
7+ using Newtonsoft . Json ;
8+ using Xunit . Abstractions ;
9+
10+ namespace FreeSql . Tests . Provider . TDengine . TDengine . TDengineIssue
11+ {
12+ public class TDengineIssueTest
13+ {
14+ private IFreeSql _fsql ;
15+ private ITestOutputHelper _output ;
16+
17+ public TDengineIssueTest ( ITestOutputHelper output )
18+ {
19+ _fsql = g . tdengine ;
20+ _output = output ;
21+ }
22+
23+ [ Fact ]
24+ void CodeFirst1977 ( )
25+ {
26+ _fsql . CodeFirst . SyncStructure ( typeof ( TDengineProcessMetrics1977 ) ) ;
27+ }
28+
29+
30+ [ Fact ]
31+ void SelectTest1977 ( )
32+ {
33+ var data = _fsql . Select < TDengineProcessMetrics1977 > ( )
34+ . ToList ( ) ;
35+ _output . WriteLine ( JsonConvert . SerializeObject ( data ) ) ;
36+ }
37+
38+ [ Fact ]
39+ void InsertTest1977 ( )
40+ {
41+ var insertAffrows = _fsql . Insert ( new TDengineProcessMetrics1977 ( )
42+ {
43+ Timestamp = DateTime . Now ,
44+ HostName = "host4" ,
45+ StartTime = DateTime . Parse ( "0001/1/1 0:00:00" ) ,
46+ }
47+ ) . ExecuteAffrows ( ) ;
48+ Assert . Equal ( 1 , insertAffrows ) ;
49+ }
50+
51+ }
52+
53+ public class TDengineProcessMetrics1977
54+ {
55+ /// <summary>
56+ /// 数据时间戳
57+ /// </summary>
58+ [ Column ( Name = "ts" ) ]
59+ public DateTime Timestamp { get ; set ; }
60+
61+ /// <summary>
62+ /// 主机名
63+ /// </summary>
64+ [ Column ( Name = "host_name" ) ]
65+ public string HostName { get ; set ; }
66+
67+ /// <summary>
68+ /// 进程启动时间
69+ /// </summary>
70+ [ Column ( Name = "start_time" ) ]
71+ public DateTime ? StartTime { get ; set ; }
72+ }
73+ }
You can’t perform that action at this time.
0 commit comments