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);
        }
示例#3
0
 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}");
         }
     }
 }
示例#4
0
 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));
 }
示例#5
0
 public static void TestValue <T>(ReactiveTable table, int rowId, T value, string columnId)
 {
     Assert.AreEqual(value, table.GetValue <T>(columnId, rowId));
 }