public ActionResult PlayerHistory(string playerName)
        {
            ViewData["PlayerName"] = playerName;

            List <PlayerViewModel>            players     = new List <PlayerViewModel>();
            StockEngine                       engine      = new YahooStockEngine();
            IEnumerable <Investment>          investments = engine.GetInvestmentHistoryForPlayer(playerName);
            IEnumerable <InvestmentViewModel> model       = investments.Select(x => new InvestmentViewModel(x));

            return(View(model));
        }
Exemplo n.º 2
0
        public void GetPlayerHistory()
        {
            // Arrange
            StockEngine          engine  = new YahooStockEngine();
            IEnumerable <string> symbols = engine.LoadSymbolsFromTextFile("aim.txt");
            string  randomSymbol         = engine.PickRandomSymbol(symbols);
            decimal walletSize           = 400;

            Player player = new Chris();
            Quote  quote1 = engine.LookupPrice(randomSymbol);

            engine.InitializePlayer(player, quote1, walletSize);

            Quote quote2 = engine.LookupPrice(randomSymbol);

            engine.InitializePlayer(player, quote2, walletSize);

            // Act
            IEnumerable <Investment> investments = engine.GetInvestmentHistoryForPlayer(player.Name);

            // Assert
            Assert.That(investments.Count(), Is.EqualTo(2));
        }