public void TestUpdateOnlyLastValue() { var target = TestTableHelper.CreateReactiveTable(); var source = new ReactiveBatchedPassThroughTable(target, new DefaultThreadMarshaller(), true); var rowUpdates = new RowUpdateHandler(); target.RowUpdates().Subscribe(rowUpdates.OnRowUpdate); var columnUpdates = new ColumnUpdateHandler(); target.ColumnUpdates().Subscribe(columnUpdates.OnColumnUpdate); TestAdd(source, target, rowUpdates); columnUpdates.LastColumnsUpdated.Clear(); source.SetValue(TestTableColumns.StringColumn, 0, "Changed"); Assert.AreEqual("Blah", target.GetValue <string>(TestTableColumns.StringColumn, 0)); source.SetValue(TestTableColumns.StringColumn, 0, "Changed2"); Assert.AreEqual("Blah", target.GetValue <string>(TestTableColumns.StringColumn, 0)); source.SynchroniseChanges(); // Check that there was only one col update fro the StringColumn Assert.AreEqual(1, columnUpdates.LastColumnsUpdated.Count); Assert.AreEqual(columnUpdates.LastColumnsUpdated.Last(), TestTableColumns.StringColumn); // And that the value is the last one Assert.AreEqual("Changed2", target.GetValue <string>(TestTableColumns.StringColumn, 0)); }
public void TestUpdate() { var target = TestTableHelper.CreateReactiveTable(); var source = new ReactiveBatchedPassThroughTable(target, new DefaultThreadMarshaller()); var rowUpdates = new RowUpdateHandler(); target.RowUpdates().Subscribe(rowUpdates.OnRowUpdate); var columnUpdates = new ColumnUpdateHandler(); target.ColumnUpdates().Subscribe(columnUpdates.OnColumnUpdate); TestAdd(source, target, rowUpdates); source.SetValue(TestTableColumns.StringColumn, 0, "Changed"); Assert.AreEqual("Blah", target.GetValue <string>(TestTableColumns.StringColumn, 0)); source.SynchroniseChanges(); Assert.AreEqual("Changed", target.GetValue <string>(TestTableColumns.StringColumn, 0)); }