public void GetCurrentQuoteForPlayer() { // Arrange StockEngine engine = new YahooStockEngine(); IEnumerable<string> symbols = engine.LoadSymbolsFromTextFile("aim.txt"); string randomSymbol = engine.PickRandomSymbol(symbols); Quote quote = engine.LookupPrice(randomSymbol); decimal walletSize = 400; // £400 Player player = new Chris(); // Act engine.InsertQuote(quote); engine.InitializePlayer(player, quote, walletSize); Quote currentQuote = engine.GetCurrentQuoteForPlayer(player.Name); // Assert Assert.That(currentQuote.Id, Is.EqualTo(quote.Id)); Assert.That(currentQuote.Symbol, Is.EqualTo(quote.Symbol)); Assert.That(currentQuote.LastTradePrice, Is.EqualTo(quote.LastTradePrice)); }
public void InitializePlayer() { // Arrange StockEngine engine = new YahooStockEngine(); IEnumerable<string> symbols = engine.LoadSymbolsFromTextFile("aim.txt"); string randomSymbol = engine.PickRandomSymbol(symbols); Quote quote = engine.LookupPrice(randomSymbol); decimal walletSize = 400; // £400 Player player = new Chris(); // Act engine.InsertQuote(quote); engine.InitializePlayer(player, quote, walletSize); // Assert Investment investment = engine.GetCurrentInvestmentForPlayer(player.Name); Assert.That(investment.Symbol, Is.EqualTo(randomSymbol)); Assert.That(investment.PlayerName, Is.EqualTo(player.GetType().Name)); Assert.That(investment.PurchaseDate, Is.GreaterThan(DateTime.Today)); Assert.That(investment.PurchasePrice, Is.EqualTo(quote.LastTradePrice.Value)); }