未验证 提交 424ef567 编写于 作者: X xiaolei li 提交者: GitHub

[TD-13948]<fix>:csharp connector test case add database fixture and e… (#10793)

* [TD-13948]<fix>:csharp connector test case add database fixture and execute order

* [TD-13948]<fix>:run CI
上级 b0824d55
......@@ -4,19 +4,32 @@ using TDengineDriver;
using System.Collections.Generic;
using Xunit;
using Test.UtilsTools.ResultSet;
using Test.Fixture;
using Test.Case.Attributes;
namespace Cases
{
public class FetchFieldsCases
[TestCaseOrderer("XUnit.Case.Orderers.TestExeOrderer", "Cases.ExeOrder")]
[Collection("Database collection")]
public class FetchFieldCases
{
DatabaseFixture database;
public FetchFieldCases(DatabaseFixture fixture)
{
this.database = fixture;
}
/// <author>xiaolei</author>
/// <Name>FetchFieldsCases.TestFetchFieldsJsonTag</Name>
/// <describe>test taos_fetch_fields(), check the meta data</describe>
/// <filename>FetchFields.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "FetchFieldsCases.TestFetchFieldsJsonTag()")]
public void TestFetchFieldsJsonTag()
[Fact(DisplayName = "FetchFieldsCases.TestFetchFieldJsonTag()"),TestExeOrder(1),Trait("Category", "FetchFieldJsonTag")]
public void TestFetchFieldJsonTag()
{
IntPtr conn = UtilsTools.TDConnection();
IntPtr conn = database.conn;
IntPtr _res = IntPtr.Zero;
string tableName = "fetch_fields";
var expectResMeta = new List<TDengineMeta> {
......
......@@ -4,8 +4,11 @@ using System.Collections.Generic;
using Xunit;
using TDengineDriver;
using Test.UtilsTools.ResultSet;
using Test.Case.Attributes;
namespace Cases
{
[TestCaseOrderer("XUnit.Case.Orderers.TestExeOrderer", "Cases.ExeOrder")]
public class FetchLengthCase
{
/// <author>xiaolei</author>
......@@ -13,7 +16,7 @@ namespace Cases
/// <describe>TD-12103 C# connector fetch_row with binary data retrieving error</describe>
/// <filename>FetchLength.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "Skip FetchLengthCase.TestRetrieveBinary()")]
[Fact(DisplayName = "FetchLengthCase.TestRetrieveBinary()"),TestExeOrder(1)]
public void TestRetrieveBinary()
{
IntPtr conn = UtilsTools.TDConnection();
......
......@@ -5,19 +5,28 @@ using Test.UtilsTools.DataSource;
using Xunit;
using System.Collections.Generic;
using Test.UtilsTools.ResultSet;
using Test.Case.Attributes;
using Test.Fixture;
namespace Cases
{
[TestCaseOrderer("XUnit.Case.Orderers.TestExeOrderer", "Cases.ExeOrder")]
[Collection("Database collection")]
public class InsertCNCases
{
DatabaseFixture database;
public InsertCNCases(DatabaseFixture fixture)
{
this.database = fixture;
}
/// <author>xiaolei</author>
/// <Name>InsertCNCases.TestNTable</Name>
/// <describe>Test insert Chinese characters into normal table's nchar column</describe>
/// <filename>InsertCn.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "InsertCNCases.TestNTable()")]
[Fact(DisplayName = "InsertCNCases.TestNTable"), TestExeOrder(1)]
public void TestNTable()
{
IntPtr conn = UtilsTools.TDConnection();
IntPtr conn = database.conn;
IntPtr _res = IntPtr.Zero;
string tableName = "cn_insert_nchar_ntable";
// var expectResData = new List<String> { "1637064040000", "true", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "XI", "XII", "{\"k1\": \"v1\"}" };
......@@ -68,10 +77,10 @@ namespace Cases
/// <describe>test insert Chinese character into stable's nchar column,both tag and column</describe>
/// <filename>InsertCn.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "InsertCNCases.TestSTable()")]
[Fact(DisplayName = "InsertCNCases.TestSTable()"), TestExeOrder(2)]
public void TestSTable()
{
IntPtr conn = UtilsTools.TDConnection();
IntPtr conn = database.conn;
IntPtr _res = IntPtr.Zero;
string tableName = "cn_insert_nchar_stable";
var colData = new List<Object>{1637064040000,1,"涛思数据",
......@@ -122,10 +131,10 @@ namespace Cases
/// <describe>test insert Chinese character into normal table's multiple nchar columns</describe>
/// <filename>InsertCn.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "InsertCNCases.TestInsertMultiNTable()")]
[Fact(DisplayName = "InsertCNCases.TestInsertMultiNTable()"), TestExeOrder(3)]
public void TestInsertMultiNTable()
{
IntPtr conn = UtilsTools.TDConnection();
IntPtr conn = database.conn;
IntPtr _res = IntPtr.Zero;
string tableName = "cn_multi_insert_nchar_ntable";
var colData = new List<Object>{1637064040000,1,"涛思数据","保利广场","Beijing","China",
......@@ -140,7 +149,7 @@ namespace Cases
};
String dropTb = "drop table if exists " + tableName;
String createTb = $"create table if not exists {tableName} (ts timestamp,v4 int,blob nchar(200),location nchar(200),city binary(100),country binary(200));";
String createTb = $"create table if not exists {tableName} (ts timestamp,v4 int,blob nchar(200),location nchar(200),city binary(100),coutry binary(200));";
String insertSql = UtilsTools.ConstructInsertSql(tableName, "", colData, null, 9);
String selectSql = "select * from " + tableName;
String dropSql = "drop table " + tableName;
......@@ -174,10 +183,10 @@ namespace Cases
/// <describe>test insert Chinese character into stable's multiple nchar columns</describe>
/// <filename>InsertCn.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "InsertCNCases.TestInsertMultiSTable()")]
[Fact(DisplayName = "InsertCNCases.TestInsertMultiSTable()"), TestExeOrder(4)]
public void TestInsertMultiSTable()
{
IntPtr conn = UtilsTools.TDConnection();
IntPtr conn = database.conn;
IntPtr _res = IntPtr.Zero;
string tableName = "cn_multi_insert_nchar_stable";
var colData = new List<Object>{1637064040000,1,"涛思数据","保利广场","Beijing","China",
......@@ -233,4 +242,4 @@ namespace Cases
}
}
}
}
\ No newline at end of file
}
......@@ -5,16 +5,27 @@ using Test.UtilsTools.DataSource;
using Xunit;
using System.Collections.Generic;
using Test.UtilsTools.ResultSet;
using Test.Fixture;
using Test.Case.Attributes;
namespace Cases
{
[TestCaseOrderer("XUnit.Case.Orderers.TestExeOrderer", "Cases.ExeOrder")]
[Collection("Database collection")]
public class NormalTableStmtCases
{
DatabaseFixture database;
public NormalTableStmtCases(DatabaseFixture fixture)
{
this.database = fixture;
}
/// <author>xiaolei</author>
/// <Name>NormalTableStmtCases.TestBindSingleLineCN</Name>
/// <describe>Test stmt insert single line of chinese character into normal table by column after column </describe>
/// <filename>StmtNormalTable.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "NormalTableStmtCases.TestBindSingleLineCN()")]
[Fact(DisplayName = "NormalTableStmtCases.TestBindSingleLineCN()"),TestExeOrder(2),Trait("Category", "bindParamCN")]
public void TestBindSingleLineCN()
{
string tableName = "ntb_stmt_cases_test_bind_single_line_cn";
......@@ -42,7 +53,7 @@ namespace Cases
List<string> expectResData = DataSource.GetNTableCNRowData();
List<TDengineMeta> expectResMeta = DataSource.GetMetaFromDDL(createTb);
IntPtr conn = UtilsTools.TDConnection();
IntPtr conn = database.conn;
UtilsTools.ExecuteUpdate(conn, dropSql);
UtilsTools.ExecuteUpdate(conn, createTb);
......@@ -80,7 +91,7 @@ namespace Cases
/// <describe>Test stmt insert single line of chinese character into normal table by column after column </describe>
/// <filename>StmtNormalTable.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "NormalTableStmtCases.TestBindColumnCN()")]
[Fact(DisplayName = "NormalTableStmtCases.TestBindColumnCN()"),TestExeOrder(4),Trait("Category", "bindSingleColumnCN")]
public void TestBindColumnCN()
{
string tableName = "ntb_stmt_cases_test_bind_column_cn";
......@@ -107,7 +118,7 @@ namespace Cases
TAOS_MULTI_BIND[] mBind = DataSource.GetMultiBindCNArr();
List<TDengineMeta> expectResMeta = DataSource.GetMetaFromDDL(createTb);
IntPtr conn = UtilsTools.TDConnection();
IntPtr conn = database.conn;
UtilsTools.ExecuteUpdate(conn, dropSql);
UtilsTools.ExecuteUpdate(conn, createTb);
......@@ -162,7 +173,7 @@ namespace Cases
/// <describe>Test stmt insert single line of chinese character into normal table by column after column </describe>
/// <filename>StmtNormalTable.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "NormalTableStmtCases.TestBindMultiLineCN()")]
[Fact(DisplayName = "NormalTableStmtCases.TestBindMultiLineCN()"),TestExeOrder(6),Trait("Category", "bindParamBatchCN")]
public void TestBindMultiLineCN()
{
string tableName = "ntb_stmt_cases_test_bind_multi_lines_cn";
......@@ -189,7 +200,7 @@ namespace Cases
List<string> expectResData = DataSource.GetMultiBindCNRowData();
List<TDengineMeta> expectResMeta = DataSource.GetMetaFromDDL(createTb);
IntPtr conn = UtilsTools.TDConnection(); ;
IntPtr conn = database.conn; ;
UtilsTools.ExecuteUpdate(conn, dropSql);
UtilsTools.ExecuteUpdate(conn, createTb);
......@@ -231,7 +242,7 @@ namespace Cases
/// <describe>Test stmt insert single line data into normal table</describe>
/// <filename>StmtNormalTable.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "NormalTableStmtCases.TestBindSingleLine")]
[Fact(DisplayName = "NormalTableStmtCases.TestBindSingleLine"),TestExeOrder(3),Trait("Category", "BindSingleColumn")]
public void TestBindSingleLine()
{
string tableName = "ntb_stmt_cases_test_bind_single_line";
......@@ -259,7 +270,7 @@ namespace Cases
List<string> expectResData = DataSource.GetNTableRowData();
List<TDengineMeta> expectResMeta = DataSource.GetMetaFromDDL(createTb);
IntPtr conn = UtilsTools.TDConnection();
IntPtr conn = database.conn;
UtilsTools.ExecuteQuery(conn, dropSql);
UtilsTools.ExecuteQuery(conn, createTb);
......@@ -296,14 +307,14 @@ namespace Cases
}
/// <author>xiaolei</author>
/// <Name>NTableMultipleLine.TestBindMultiLine</Name>
/// <Name>NormalTableStmtCases.TestBindMultiLine</Name>
/// <describe>Test stmt insert multiple rows of data into normal table</describe>
/// <filename>StmtNormalTable.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "NormalTableStmtCases.TestBindMultiLine()")]
[Fact(DisplayName = "NormalTableStmtCases.TestBindMultiLine()"),TestExeOrder(5),Trait("Category", "bindParamBatch")]
public void TestBindMultiLine()
{
string tableName = "normal_table_stmt_cases_test_bind_multi_lines";
string tableName = "ntb_stmt_case_test_bind_multi_lines";
String createTb = $"create table if not exists {tableName} " +
" (" +
"ts timestamp," +
......@@ -327,7 +338,7 @@ namespace Cases
TAOS_MULTI_BIND[] mBind = DataSource.GetMultiBindArr();
List<TDengineMeta> expectResMeta = DataSource.GetMetaFromDDL(createTb);
IntPtr conn = UtilsTools.TDConnection();
IntPtr conn = database.conn;
UtilsTools.ExecuteUpdate(conn, dropSql);
UtilsTools.ExecuteUpdate(conn, createTb);
......@@ -365,14 +376,14 @@ namespace Cases
}
/// <author>xiaolei</author>
/// <Name>NormalTableStmtCases.TestBindColumnCn</Name>
/// <Name>NormalTableStmtCases.TestBindColumn</Name>
/// <describe>Test stmt insert multiple rows of data into normal table by column after column </describe>
/// <filename>StmtNormalTable.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "NormalTableStmtCases.TestBindColumn()")]
[Fact(DisplayName = "NormalTableStmtCases.TestBindColumn()"),TestExeOrder(1),Trait("Category", "bindParam")]
public void TestBindColumn()
{
string tableName = "ntb_stmt_cases_test_bind_column_cn";
string tableName = "ntb_stmt_cases_test_bind_column";
DataSource data = new DataSource();
String createTb = $"create table if not exists {tableName} " +
" (" +
......@@ -398,7 +409,7 @@ namespace Cases
List<TDengineMeta> expectResMeta = DataSource.GetMetaFromDDL(createTb);
IntPtr conn = UtilsTools.TDConnection();
IntPtr conn = database.conn;
UtilsTools.ExecuteUpdate(conn, dropSql);
UtilsTools.ExecuteUpdate(conn, createTb);
......
......@@ -5,17 +5,30 @@ using Test.UtilsTools.DataSource;
using System.Collections.Generic;
using Test.UtilsTools.ResultSet;
using Xunit;
using Test.Fixture;
using Test.Case.Attributes;
namespace Cases
{
[TestCaseOrderer("XUnit.Case.Orderers.TestExeOrderer", "Cases.ExeOrder")]
[Collection("Database collection")]
public class StableStmtCases
{
DatabaseFixture database;
public StableStmtCases(DatabaseFixture fixture)
{
this.database = fixture;
}
/// <author>xiaolei</author>
/// <Name>StableStmtCases.TestBindSingleLineCN</Name>
/// <describe>Test stmt insert single line of chinese character into stable by column after column </describe>
/// <filename>StmtSTable.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "StableStmtCases.TestBindSingleLineCN()")]
[Fact(DisplayName = "StableStmtCases.TestBindSingleLineCN()"),TestExeOrder(2),Trait("Category", "BindParamCN")]
public void TestBindSingleLineCN()
{
string tableName = "stb_stmt_cases_test_bind_single_line_cn";
......@@ -57,7 +70,7 @@ namespace Cases
TAOS_BIND[] tags = DataSource.GetCNTags();
TAOS_BIND[] binds = DataSource.GetNTableCNRow();
IntPtr conn = UtilsTools.TDConnection();
IntPtr conn = database.conn;
UtilsTools.ExecuteUpdate(conn, dropSql);
UtilsTools.ExecuteUpdate(conn, createSql);
......@@ -99,7 +112,7 @@ namespace Cases
/// <describe>Test stmt insert single line of chinese character into stable by column after column </describe>
/// <filename>StmtSTable.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "StableStmtCases.TestBindColumnCN()")]
[Fact(DisplayName = "StableStmtCases.TestBindColumnCN()"),TestExeOrder(4),Trait("Category", "BindParamColumnCN")]
public void TestBindColumnCN()
{
string tableName = "stb_stmt_cases_test_bindcolumn_cn";
......@@ -141,7 +154,7 @@ namespace Cases
List<TDengineMeta> expectResMeta = DataSource.GetMetaFromDDL(createSql);
List<String> expectResData = DataSource.GetMultiBindStableCNRowData();
IntPtr conn = UtilsTools.TDConnection();
IntPtr conn = database.conn;
UtilsTools.ExecuteUpdate(conn, dropSql);
UtilsTools.ExecuteUpdate(conn, createSql);
......@@ -199,7 +212,7 @@ namespace Cases
/// <describe>Test stmt insert single line of chinese character into stable by column after column </describe>
/// <filename>StmtSTable.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "StableStmtCases.TestBindMultiLineCN()")]
[Fact(DisplayName = "StableStmtCases.TestBindMultiLineCN()"),TestExeOrder(6),Trait("Category", "BindParamBatchCN")]
public void TestBindMultiLineCN()
{
string tableName = "stb_stmt_cases_test_bind_multi_line_cn";
......@@ -241,7 +254,7 @@ namespace Cases
List<TDengineMeta> expectResMeta = DataSource.GetMetaFromDDL(createSql);
List<String> expectResData = DataSource.GetMultiBindStableCNRowData();
IntPtr conn = UtilsTools.TDConnection();
IntPtr conn = database.conn;
UtilsTools.ExecuteUpdate(conn, dropSql);
UtilsTools.ExecuteUpdate(conn, createSql);
......@@ -282,11 +295,11 @@ namespace Cases
/// <describe>Test stmt insert single line into stable by column after column </describe>
/// <filename>StmtSTable.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "StableStmtCases.TestBindMultiLine()")]
[Fact(DisplayName = "StableStmtCases.TestBindMultiLine()"),TestExeOrder(5),Trait("Category", "BindParamBatch")]
public void TestBindMultiLine()
{
string tableName = "stb_stmt_cases_test_bind_multi_line";
string createSql = $"create stable if not exists {tableName} " +
string createSql = $"create stable if not exists {tableName} " +
"(ts timestamp," +
"b bool," +
"v1 tinyint," +
......@@ -324,7 +337,7 @@ namespace Cases
List<TDengineMeta> expectResMeta = DataSource.GetMetaFromDDL(createSql);
List<String> expectResData = DataSource.GetMultiBindStableRowData();
IntPtr conn = UtilsTools.TDConnection();
IntPtr conn = database.conn;
UtilsTools.ExecuteUpdate(conn, dropSql);
UtilsTools.ExecuteUpdate(conn, createSql);
......@@ -370,7 +383,7 @@ namespace Cases
/// <describe>Test stmt insert single line of chinese character into stable by column after column </describe>
/// <filename>StmtSTable.cs</filename>
/// <result>pass or failed </result>
[Fact(DisplayName = "StableStmtCases.TestBindColumn()")]
[Fact(DisplayName = "StableStmtCases.TestBindColumn()"),TestExeOrder(3),Trait("Category", "BindParamColumn")]
public void TestBindColumn()
{
string tableName = "stb_stmt_cases_test_bindcolumn";
......@@ -412,7 +425,7 @@ namespace Cases
List<TDengineMeta> expectResMeta = DataSource.GetMetaFromDDL(createSql);
List<String> expectResData = DataSource.GetMultiBindStableRowData();
IntPtr conn = UtilsTools.TDConnection();
IntPtr conn = database.conn;
UtilsTools.ExecuteUpdate(conn, dropSql);
UtilsTools.ExecuteUpdate(conn, createSql);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册