示例#1
0
        public void DataPushRequestIsForwardedToLocalStorage()
        {
            var instrument = new Instrument
            {
                ID         = 1,
                Symbol     = "SPY",
                Datasource = new Datasource {
                    ID = 1, Name = "MockSource"
                }
            };
            var data = new List <OHLCBar>
            {
                new OHLCBar {
                    Open = 1, High = 2, Low = 3, Close = 4, DT = new DateTime(2013, 1, 1)
                }
            };
            var req = new DataAdditionRequest(BarSize.OneDay, instrument, data);

            _client.PushData(req);
            // TODO: Think about delay amount
            Thread.Sleep(50);

            _historicalDataBrokerMock.Verify(
                x => x.AddData(
                    It.Is <DataAdditionRequest>(
                        y =>
                        y.Frequency == BarSize.OneDay &&
                        y.Instrument.ID == 1 &&
                        y.Data.Count == 1)
                    ),
                Times.Once);
        }