public Application(TradingModel model) { _model = model; }
public void TestInitialize() { _statisticsServiceMock = new Mock<IStatisticsService>(); _forexMarketServiceMock = new Mock<IForexMarketService>(); _forexTradingAgentServiceMock = new Mock<IForexTradingAgentService>(); _forexTradingServiceMock = new Mock<IForexTradingService>(); _periods = new List<string> { "300", "600", "900", "1800" }; _months = new List<string>(); for (var i = 1; i <= 12; i++) { _months.Add(string.Format("{0:00}", i)); } _statisticsSequence = new List<StatisticsSequenceDto> { new StatisticsSequenceDto { C45Errors = 10, C50Errors = 9, Cases = 500, Chunk = 0 }, new StatisticsSequenceDto { C45Errors = 10, C50Errors = 9, Cases = 499, Chunk = 1 }, new StatisticsSequenceDto { C45Errors = 10, C50Errors = 9, Cases = 501, Chunk = 2 }, new StatisticsSequenceDto { C45Errors = 10, C50Errors = 9, Cases = 498, Chunk = 3 }, new StatisticsSequenceDto { C45Errors = 10, C50Errors = 9, Cases = 502, Chunk = 4 } }; _nextRecordCalls = 0; _nextRecordCallsOverall = 0; _forexTrees = new List<ForexTreeData> { new ForexTreeData { Bid = 1.1111, Ask = 1.1115 }, new ForexTreeData { Bid = 1.1110, Ask = 1.1114 }, new ForexTreeData { Bid = 1.1109, Ask = 1.1112 }, new ForexTreeData { Bid = 1.1107, Ask = 1.1110 }, new ForexTreeData { Bid = 1.1105, Ask = 1.1105 } }; _forexMarketServiceMock .Setup(x => x.NextRecord()) .Returns(_forexTrees[_nextRecordCalls]) .Callback(() => { _nextRecordCalls++; _nextRecordCallsOverall++; }); _forexTradingAgentServiceMock .Setup(x => x.ClassifyRecord(It.IsAny<ForexTreeData>())) .Returns(MarketAction.Buy); _forexMarketServiceMock .Setup(x => x.IsDone()) .Returns(() => _nextRecordCalls == _forexTrees.Count); _forexMarketServiceMock .Setup(x => x.Clear()) .Callback(() => _nextRecordCalls = 0); _statisticsServiceMock .SetupGet(x => x.StatisticsSequence) .Returns(_statisticsSequence); _forexTradingServiceMock .Setup(x => x.BidSize) .Returns(2000.0); _model = new TradingModel( _statisticsServiceMock.Object, _forexMarketServiceMock.Object, _forexTradingAgentServiceMock.Object, _forexTradingServiceMock.Object ); }