public void TestUpdate() { var target = TestTableHelper.CreateReactiveTable(); var source = new ReactivePassThroughTable(target, new DefaultThreadMarshaller()); var updateHandler = new RowUpdateHandler(); target.RowUpdates().Subscribe(updateHandler.OnRowUpdate); var sourceRow1 = source.AddRow(); Assert.AreEqual(1, target.RowCount); TestTableHelper.SetAndTestValue(source, target, sourceRow1, updateHandler.LastRowUpdated, 101, TestTableColumns.IdColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow1, updateHandler.LastRowUpdated, "Blah", TestTableColumns.StringColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow1, updateHandler.LastRowUpdated, 4324m, TestTableColumns.DecimalColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow1, updateHandler.LastRowUpdated, 103, TestTableColumns.IdColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow1, updateHandler.LastRowUpdated, "Blah2", TestTableColumns.StringColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow1, updateHandler.LastRowUpdated, 43999m, TestTableColumns.DecimalColumn); var sourceRow2 = source.AddRow(); Assert.AreEqual(2, target.RowCount); TestTableHelper.SetAndTestValue(source, target, sourceRow2, updateHandler.LastRowUpdated, 102, TestTableColumns.IdColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow2, updateHandler.LastRowUpdated, "Blah2", TestTableColumns.StringColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow2, updateHandler.LastRowUpdated, 42m, TestTableColumns.DecimalColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow2, updateHandler.LastRowUpdated, 104, TestTableColumns.IdColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow2, updateHandler.LastRowUpdated, "Blah4", TestTableColumns.StringColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow2, updateHandler.LastRowUpdated, 421111m, TestTableColumns.DecimalColumn); }
public void TestUpdate() { var table = TestTableHelper.CreateReactiveTable(); var rowId1 = table.AddRow(); Assert.AreEqual(1, table.RowCount); TestTableHelper.SetAndTestValue(table, rowId1, 123, TestTableColumns.IdColumn); TestTableHelper.SetAndTestValue(table, rowId1, "Hello", TestTableColumns.StringColumn); TestTableHelper.SetAndTestValue(table, rowId1, 321m, TestTableColumns.DecimalColumn); var rowId2 = table.AddRow(); Assert.AreEqual(2, table.RowCount); TestTableHelper.SetAndTestValue(table, rowId2, 1234, TestTableColumns.IdColumn); TestTableHelper.SetAndTestValue(table, rowId2, "Hello 12", TestTableColumns.StringColumn); TestTableHelper.SetAndTestValue(table, rowId2, 3214m, TestTableColumns.DecimalColumn); TestTableHelper.SetAndTestValue(table, rowId2, 12341, TestTableColumns.IdColumn); TestTableHelper.SetAndTestValue(table, rowId2, "Hello", TestTableColumns.StringColumn); TestTableHelper.SetAndTestValue(table, rowId2, 321m, TestTableColumns.DecimalColumn); TestTableHelper.SetAndTestValue(table, rowId1, 321, TestTableColumns.IdColumn); TestTableHelper.SetAndTestValue(table, rowId1, "Hello 334", TestTableColumns.StringColumn); TestTableHelper.SetAndTestValue(table, rowId1, 32132m, TestTableColumns.DecimalColumn); }
// [Test] public void TestDelete() { var source = TestTableHelper.CreateReactiveTable(); var target = TestTableHelper.CreateReactiveTable(); var synchroniser = new BatchedTableSynchroniser(source, target, new DefaultThreadMarshaller(), TimeSpan.FromMilliseconds(delay)); var updateHandler = new RowUpdateHandler(); target.RowUpdates().Subscribe(updateHandler.OnRowUpdate); var sourceRow1 = source.AddRow(); Assert.AreEqual(1, target.RowCount); TestTableHelper.SetAndTestValue(source, target, sourceRow1, updateHandler.LastRowUpdated, 101, TestTableColumns.IdColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow1, updateHandler.LastRowUpdated, "Blah", TestTableColumns.StringColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow1, updateHandler.LastRowUpdated, 4324m, TestTableColumns.DecimalColumn); var sourceRow2 = source.AddRow(); Assert.AreEqual(2, target.RowCount); var targetRow2 = updateHandler.LastRowUpdated; TestTableHelper.SetAndTestValue(source, target, sourceRow2, updateHandler.LastRowUpdated, 102, TestTableColumns.IdColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow2, updateHandler.LastRowUpdated, "Blah2", TestTableColumns.StringColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow2, updateHandler.LastRowUpdated, 42m, TestTableColumns.DecimalColumn); source.DeleteRow(sourceRow1); Assert.AreEqual(1, target.RowCount); Assert.AreEqual(102, target.GetValue <int>(TestTableColumns.IdColumn, targetRow2)); source.DeleteRow(sourceRow2); Assert.AreEqual(0, target.RowCount); var sourceRow3 = source.AddRow(); Assert.AreEqual(1, target.RowCount); TestTableHelper.SetAndTestValue(source, target, sourceRow3, updateHandler.LastRowUpdated, 101, TestTableColumns.IdColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow3, updateHandler.LastRowUpdated, "Blah", TestTableColumns.StringColumn); TestTableHelper.SetAndTestValue(source, target, sourceRow3, updateHandler.LastRowUpdated, 4324m, TestTableColumns.DecimalColumn); }