private static void Initialize() { StockEngine engine = new YahooStockEngine(); engine.ReInitializeAllPlayers(400); IEnumerable<Quote> stocks = engine.LookupQuotesForPlayers(engine.GetAllPlayers().Select(x => x.Name).ToArray()); engine.InsertQuotes(stocks); Log.Information("Saved {0} new stock prices to the database.", stocks.Count()); Log.Information("Initialized all players"); Console.WriteLine("Saved {0} new stock prices to the database.", stocks.Count()); Console.WriteLine("Initialized all players"); }
public void LookupQuotesForPlayers() { // Arrange StockEngine engine = new YahooStockEngine(); decimal walletSize = 400; engine.ReInitializeAllPlayers(walletSize); // Act IEnumerable<Quote> quotes = engine.LookupQuotesForPlayers(engine.GetAllPlayers().Select(x => x.Name).ToArray()); // Assert Assert.That(quotes.Count(), Is.EqualTo(5)); }
public void ReInitializeAllPlayers() { // Arrange StockEngine engine = new YahooStockEngine(); decimal walletSize = 400; // Act engine.ReInitializeAllPlayers(walletSize); // Assert List<Investment> investments = engine.GetInvestments().ToList(); Assert.That(investments.Count, Is.EqualTo(5)); Assert.NotNull(investments.FirstOrDefault(x => x.PlayerName == "Chris")); Assert.NotNull(investments.FirstOrDefault(x => x.PlayerName == "Fiona")); Assert.NotNull(investments.FirstOrDefault(x => x.PlayerName == "Wilson")); Assert.NotNull(investments.FirstOrDefault(x => x.PlayerName == "Katherine")); Assert.NotNull(investments.FirstOrDefault(x => x.PlayerName == "Jon")); }