public void ControlDataMergeMainTest() { var helper = new MergeDataHelper(); var result = helper.MergeData(_testMarketDataDource.ToArray()); CheckControlDataResult(result); }
public void ControlDataNullInputSourceMainTest() { var helper = new MergeDataHelper(); var result = helper.MergeData(null); Assert.IsNotNull(result); Assert.IsTrue(result.Count == 0); }
public void ControlDataMergeMainFourthTest() { var emptyData = new List <MarketDataUpdate>(); var helper = new MergeDataHelper(); var result = helper.MergeData(emptyData.ToArray()); CheckControlFourthDataResult(result); }
public void ControlDataMergeMainSecondTest() { var testMarketDataDource = getSecondTestData(); var helper = new MergeDataHelper(); var result = helper.MergeData(testMarketDataDource.ToArray()); CheckSecondControlDataResult(result); }
private void CreateMarketDataProcessingDataFlow() { _source = new BufferBlock <MarketDataUpdate>(new DataflowBlockOptions() { BoundedCapacity = DataAggregatorAppSettings.BufferBoundedCapacity }); _batchBlock = new BatchBlock <MarketDataUpdate>(batchSize: DataAggregatorAppSettings.BatchSize, new GroupingDataflowBlockOptions() { Greedy = true }); _writer = new ActionBlock <List <MarketDataUpdate> >(cd => { Console.WriteLine("-------------------------------------------------------"); cd.ForEach(d => Console.WriteLine(d)); Console.WriteLine("*******************************************************"); // snapshot work with current copy data - thread safe. _watchers?.ToList().ForEach(watcher => watcher.OnUpdate(cd.ToArray())); }); _transformBlock = new TransformBlock <MarketDataUpdate[], List <MarketDataUpdate> >(e => { var helper = new MergeDataHelper(); return(helper.MergeData(e)); }); _source.LinkTo(_batchBlock, new DataflowLinkOptions() { PropagateCompletion = true }); _batchBlock.LinkTo(_transformBlock, new DataflowLinkOptions() { PropagateCompletion = true }); _transformBlock.LinkTo(_writer, new DataflowLinkOptions() { PropagateCompletion = true }); _timer = new Timer(x => { _batchBlock.TriggerBatch(); }); _timer.Change(DataAggregatorAppSettings.TimerDueTimeMiliseconds, DataAggregatorAppSettings.TimerPeriodMiliseconds); }