Exemplo n.º 1
0
        public void RecalculateStockWeigth_EmptyCollection()
        {
            //Arrange
            var viewModel = new StockPanelViewModel();

            //Act
            var result = viewModel.RecalculateStockWeigth(null);

            //Assert
            Assert.AreEqual(result, null);
        }
Exemplo n.º 2
0
        public void RecalculateStockWeigth_NotEmptyCollection()
        {
            //Arrange
            var viewModel  = new StockPanelViewModel();
            var collection = new ObservableCollection <Stock>();

            collection.Add(new Stock {
                MarketValue = 3.0
            });
            collection.Add(new Stock {
                MarketValue = 2.0
            });

            //Act
            var result = viewModel.RecalculateStockWeigth(collection);

            //Assert
            Assert.AreEqual(result[0].StockWeight, 60);
            Assert.AreEqual(result[1].StockWeight, 40);
        }