private void OnNext(TableUpdate update) { var onCollectionChanged = CollectionChanged; var onPropertyChanged = PropertyChanged; if (update.Action == TableUpdateAction.Add) { if (onCollectionChanged != null) { var obj = _table.GetValue(update.Column.ColumnId, update.RowIndex); onCollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, obj, update.RowIndex)); } } if (update.Action == TableUpdateAction.Update) { if (onPropertyChanged != null) { onPropertyChanged(this, new PropertyChangedEventArgs(update.Column.ColumnId)); // onCollectionChanged(this, new NotifyCollectionChangedEventArgs(Replace)); } } if (update.Action == TableUpdateAction.Delete) { if (onCollectionChanged != null) { var obj = _table.GetValue(update.Column.ColumnId, update.RowIndex); onCollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, obj, update.RowIndex)); } } }
public void Iterate() { var id = _table.AddRow(); _table.SetValue("IdCol", id, 1); _table.SetValue("TextCol", id, "Some longer string that should take up some more space"); _table.SetValue("ValueCol", id, 23213214214.3423m); var calc1 = _table.GetValue <decimal>("CalcCol1", id); var calc2 = _table.GetValue <string>("CalcCol2", id); }
public void CompareTables(ReactiveTable expectedTable, ReactiveTable table) { Assert.AreEqual(expectedTable.RowCount, table.RowCount); Assert.AreEqual(expectedTable.Columns.Count, table.Columns.Count); foreach (var column in expectedTable.Columns) { IReactiveColumn col; Assert.IsTrue(table.GetColumnByName(column.ColumnId, out col)); for (var i = 0; i < expectedTable.RowCount; i++) { // Cheating a little by relying on the fact that i know the row id starts at 0. Assert.AreEqual(expectedTable.GetValue(column.ColumnId, i), table.GetValue(column.ColumnId, i), $"For column {column.ColumnId}"); } } }
public static void SetAndTestValueNotPresent <T>(ReactiveTable setTable, ReactiveTable getTable, int setRowId, int getRowId, T value, string columnId) { setTable.SetValue(columnId, setRowId, value); Assert.AreEqual(default(T), getTable.GetValue <T>(columnId, getRowId)); }
public static void TestValue <T>(ReactiveTable table, int rowId, T value, string columnId) { Assert.AreEqual(value, table.GetValue <T>(columnId, rowId)); }