public void CanInitPresenter() { var historyService = new MockMarketHistoryService(); var eventAggregator = new Mock<IEventAggregator>(); eventAggregator.Setup(x => x.GetEvent<TickerSymbolSelectedEvent>()).Returns( new MockTickerSymbolSelectedEvent()); TrendLineViewModel presentationModel = new TrendLineViewModel(historyService, eventAggregator.Object); Assert.IsNotNull(presentationModel); }
public void ShouldUpdateModelWithDataFromServiceOnTickerSymbolSelected() { var historyService = new MockMarketHistoryService(); var tickerSymbolSelected = new MockTickerSymbolSelectedEvent(); var eventAggregator = new Mock<IEventAggregator>(); eventAggregator.Setup(x => x.GetEvent<TickerSymbolSelectedEvent>()).Returns( tickerSymbolSelected); TrendLineViewModel presentationModel = new TrendLineViewModel(historyService, eventAggregator.Object); 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); }
public TrendLineView(TrendLineViewModel viewModel) { ViewModel = viewModel; InitializeComponent(); }