Ejemplo n.º 1
0
        public void CanInitPresenter()
        {
            var historyService  = new MockMarketHistoryService();
            var view            = new MockTrendLineView();
            var eventAggregator = new MockEventAggregator();

            eventAggregator.AddMapping <TickerSymbolSelectedEvent>(new MockTickerSymbolSelectedEvent());
            TrendLinePresentationModel presentationModel = new TrendLinePresentationModel(view, historyService, eventAggregator);

            Assert.IsNotNull(presentationModel);
        }
Ejemplo n.º 2
0
        public void ShouldUpdateModelWithDataFromServiceOnTickerSymbolSelected()
        {
            var historyService       = new MockMarketHistoryService();
            var eventAggregator      = new MockEventAggregator();
            var tickerSymbolSelected = new MockTickerSymbolSelectedEvent();

            eventAggregator.AddMapping <TickerSymbolSelectedEvent>(tickerSymbolSelected);
            TrendLinePresentationModel presentationModel = new TrendLinePresentationModel(new MockTrendLineView(), historyService, eventAggregator);

            tickerSymbolSelected.SubscribeArgumentAction("MyTickerSymbol");

            Assert.IsTrue(historyService.GetPriceHistoryCalled);
            Assert.AreEqual("MyTickerSymbol", historyService.GetPriceHistoryArgument);
            Assert.IsNotNull(presentationModel.HistoryCollection);
            Assert.AreEqual(historyService.Data.Count, presentationModel.HistoryCollection.Count);
            Assert.AreEqual(historyService.Data[0], presentationModel.HistoryCollection[0]);
            Assert.AreEqual("MyTickerSymbol", presentationModel.TickerSymbol);
        }