private static void CheckValuesAreSorted(int count, SortedTable table) { Assert.AreEqual(count, table.RowCount); for (var i = 0; i < table.RowCount; i++) { var id = table.GetValue <int>(TestTableColumns.IdColumn, i); var s = table.GetValue <string>(TestTableColumns.StringColumn, i); Assert.AreEqual(i, id); Assert.AreEqual($"Item #{i.ToString("0000")}", s); } }
public void TestUpdatingSortKey() { var sourceTable = TestTableHelper.CreateReactiveTable(); const int count = 100; AddValuesInReverseOrder(count, sourceTable); var table = new SortedTable(sourceTable); table.SortBy(TestTableColumns.StringColumn, Comparer <string> .Default); CheckValuesAreSorted(count, table); var rowId = 5; sourceTable.SetValue(TestTableColumns.StringColumn, rowId, "_"); Assert.AreEqual("_", table.GetValue(TestTableColumns.StringColumn, 0)); rowId = 6; sourceTable.SetValue(TestTableColumns.StringColumn, rowId, "X"); Assert.AreEqual("X", table.GetValue(TestTableColumns.StringColumn, count - 1)); }