var table1 = new DataTable(); table1.Columns.Add("Name", typeof(string)); table1.Rows.Add("John"); var table2 = new DataTable(); table2.Columns.Add("Name", typeof(string)); table2.Rows.Add("John"); TestUtility.AssertTableContent(table1, table2);
var table1 = new DataTable(); table1.Columns.Add("Age", typeof(int)); table1.Rows.Add(25); var table2 = new DataTable(); table2.Columns.Add("Age", typeof(double)); table2.Rows.Add(25.0); TestUtility.AssertTableContent(table1, table2, new AssertTableContentOptions { NumericTolerance = 0.1 });This example shows how to compare two DataTables with different data types (int and double) for the same column. The `NumericTolerance` option is used to allow for a small difference between the two values. The TestUtility package library can be found in the Microsoft.VisualStudio.TestTools.UnitTesting namespace.