Пример #1
0
        private void GetAllStocks()
        {
            var stocks = _fundService.AllStocks().Select(s => _stockConverter.Convert(EventAggregator, s));

            Stocks = new List <StockItem>(stocks);
            OnPropertyChanged(() => Stocks);
        }
Пример #2
0
        public void AddFirstEquityStockSuccess()
        {
            var request = new BaseStockModel()
            {
                Price    = 1,
                Quantity = 1,
                Type     = StockType.Equity
            };

            _fundService.AddStock(request);

            var allStocks = _fundService.AllStocks().ToArray();

            _eventAggregatorMock.VerifyGetEvent();
            _fundChangedEventMock.VerifyPublishEvent();

            Assert.That(allStocks.Count(), Is.EqualTo(1));
            Assert.That(allStocks[0].Type, Is.EqualTo(request.Type));
            Assert.That(allStocks[0].Price, Is.EqualTo(request.Price));
            Assert.That(allStocks[0].Quantity, Is.EqualTo(request.Quantity));
            Assert.That(allStocks[0].TotalMarketValue, Is.EqualTo(request.Price * request.Quantity));
        }