Skip to content

Commit

Permalink
Adding more tests (#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkWanderer authored Mar 10, 2024
1 parent b58d851 commit fef798d
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions ClickHouse.Client.Tests/ADO/DataAdapterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Threading.Tasks;
using ClickHouse.Client.ADO.Adapters;
using ClickHouse.Client.Utility;
using NUnit.Framework;

namespace ClickHouse.Client.Tests.ADO;
Expand Down Expand Up @@ -71,11 +72,24 @@ public void DataAdapterShouldFillSingleValue(string sql)
command.CommandText = sql;
adapter.SelectCommand = command;

var dataTable = new DataTable();
adapter.Fill(dataTable);
var table = new DataTable();
adapter.Fill(table);

Assert.AreEqual(1, table.Rows.Count);
Assert.AreEqual(1, table.Columns.Count);
Assert.AreEqual("col", table.Columns[0].ColumnName);
}

[Test]
[Parallelizable]
[TestCaseSource(typeof(DataAdapterTests), nameof(SimpleSelectQueries))]
public void ShouldReadDataTable(string sql)
{
using var adapter = new ClickHouseDataAdapter();
using var table = connection.ExecuteDataTable(sql);

Assert.AreEqual(1, dataTable.Rows.Count);
Assert.AreEqual(1, dataTable.Columns.Count);
Assert.AreEqual("col", dataTable.Columns[0].ColumnName);
Assert.AreEqual(1, table.Rows.Count);
Assert.AreEqual(1, table.Columns.Count);
Assert.AreEqual("col", table.Columns[0].ColumnName);
}
}

0 comments on commit fef798d

Please sign in to comment.