コード例 #1
0
        public void ShouldReadValuesFromFlyWeight()
        {
            var table = new ReactiveTable <TestModelFlyweight>();

            Check.That(table.Columns).HasSize(4);
            CheckColumn(table, 0, "TestModelFlyweight.Id", typeof(int));
            CheckColumn(table, 1, "TestModelFlyweight.Name", typeof(string));
            CheckColumn(table, 2, "TestModelFlyweight.Value", typeof(decimal));
            CheckColumn(table, 3, "TestModelFlyweight.Timestamp", typeof(DateTime));

            var row = table.AddRow();

            table.SetValue("TestModelFlyweight.Id", row, 42);
            table.SetValue("TestModelFlyweight.Name", row, "Hello");
            table.SetValue("TestModelFlyweight.Value", row, 43m);
            var dateTime = DateTime.UtcNow;

            table.SetValue("TestModelFlyweight.Timestamp", row, dateTime);

            var flyweight = table.Flyweights[0];

            Check.That(flyweight.Id).IsEqualTo(42);
            Check.That(flyweight.Name).IsEqualTo("Hello");
            Check.That(flyweight.Value).IsEqualTo(43m);
            Check.That(flyweight.Timestamp).IsEqualTo(dateTime);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        private void AddRow(string groupVal, int value)
        {
            var row1 = _table1.AddRow();

            _table1.SetValue(GroupColumnId, row1, groupVal);
            _table1.SetValue(ValueColumnId, row1, value);
            _highWaterMark = Math.Max(_table1.RowCount, _highWaterMark);
        }
コード例 #4
0
 public int AddRow()
 {
     lock (_rowManager)
     {
         var rowIndex = _rowManager.AddRow();
         _marshaller.Dispatch(() => _targetTargetTable.AddRow());
         return(rowIndex);
     }
 }
コード例 #5
0
        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);
        }
コード例 #6
0
        protected int AddEntry(int id)
        {
            var rowIndex = Table.AddRow();

            Table.SetValue <int>(IdCol, rowIndex, id);
            Table.SetValue(TextCol, rowIndex, "Some longer string that should take up some more space");
            Table.SetValue(ValueCol, rowIndex, 23213214214.3423m);
            Table.SetValue(DoubleCol, rowIndex, 234.23435);
            Table.SetValue(BoolCol, rowIndex, true);
            return(rowIndex);
        }
コード例 #7
0
        private static void AddValuesInReverseOrder(int count, ReactiveTable sourceTable, int startIndex = 0)
        {
            var end = startIndex + count - 1;

            for (var i = end; i >= startIndex; i--)
            {
                var rowId = sourceTable.AddRow();
                var id    = i;
                sourceTable.SetValue(TestTableColumns.IdColumn, rowId, id);
                sourceTable.SetValue(TestTableColumns.StringColumn, rowId, $"Item #{id.ToString("0000")}");
            }
        }
コード例 #8
0
        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("ValueCol1", id, 23213214214.3423m);
            _table.SetValue("ValueCol2", id, 23213214214.3423d);
            _table.SetValue("ValueCol3", id, 23213214214.3423f);
            _table.SetValue("ValueCol4", id, true);
            _table.SetValue("ValueCol5", id, "Another long string");
            _table.SetValue("ValueCol6", id, DateTime.Now);
        }
コード例 #9
0
ファイル: Server.cs プロジェクト: windygu/ReactiveTables
        private void AddRates(ReactiveTable fxRates, Dictionary <string, int> ccyPairsToRowIds)
        {
            for (var i = 0; i < _currencyList.Length; i++)
            {
                for (var j = i + 1; j < _currencyList.Length; j++)
                {
                    var ccy1 = _currencyList[i];
                    var ccy2 = _currencyList[j];

                    var rowId   = fxRates.AddRow();
                    var ccyPair = ccy1 + ccy2;
                    ccyPairsToRowIds[ccyPair] = rowId;
                }
            }
        }
コード例 #10
0
        private void TestSyncrhonisedDuplicate(int rowCount)
        {
            var uiTable   = TableTestHelper.CreateReactiveTable();
            var wireTable = new ReactiveTable(uiTable);

            new TableSynchroniser(wireTable, uiTable, new DefaultThreadMarshaller());

            for (var i = 0; i < rowCount; i++)
            {
                var rowIndex = wireTable.AddRow();
                wireTable.SetValue(TestTableColumns.IdColumn, rowIndex, i);
                wireTable.SetValue(TestTableColumns.StringColumn, rowIndex, $"Entry {i}");
                wireTable.SetValue(TestTableColumns.DecimalColumn, rowIndex, (decimal)i);
            }
        }
コード例 #11
0
        public void ShouldFlyweightShouldNotifyOfChanges()
        {
            var table = new ReactiveTable <TestModelFlyweight>();

            var row       = table.AddRow();
            var flyweight = table.Flyweights[0];

            var changes = new List <string>();

            flyweight.PropertyChanged += (sender, args) => changes.Add(args.PropertyName);

            table.SetValue("TestModelFlyweight.Id", row, 42);
            table.SetValue("TestModelFlyweight.Name", row, "Hello");
            table.SetValue("TestModelFlyweight.Value", row, 43m);
            var dateTime = DateTime.UtcNow;

            table.SetValue("TestModelFlyweight.Timestamp", row, dateTime);

            Check.That(changes).ContainsExactly("Id", "Name", "Value", "Timestamp");
        }
コード例 #12
0
        public static int AddTestRow(ReactiveTable table, bool includeComplexTypes = true)
        {
            var rowId = table.AddRow();

            table.SetValue(TestTableColumns.IdColumn, rowId, 1);
            table.SetValue(TestTableColumns.StringColumn, rowId, "Foo");
            table.SetValue(TestTableColumns.BoolColumn, rowId, false);
            table.SetValue(TestTableColumns.DoubleColumn, rowId, 1111.232);
            table.SetValue(TestTableColumns.ShortColumn, rowId, (short)4242);
            table.SetValue(TestTableColumns.LongColumn, rowId, 22222222222222);
            table.SetValue(TestTableColumns.DecimalColumn, rowId, 2132.233m);

            if (includeComplexTypes)
            {
                table.SetValue(TestTableColumns.DateTimeColumn, rowId, new DateTime(1982, 04, 10));
                table.SetValue(TestTableColumns.TimespanColumn, rowId, TimeSpan.FromDays(1));
                table.SetValue(TestTableColumns.GuidColumn, rowId, Guid.NewGuid());
            }

            table.SetValue(TestTableColumns.FloatColumn, rowId, 6.6542f);
            table.SetValue(TestTableColumns.ByteColumn, rowId, (byte)188);
            table.SetValue(TestTableColumns.CharColumn, rowId, 'D');
            return(rowId);
        }