public void GetPriceEmptyList() { var priceHistory = new StockPriceHistory(Guid.NewGuid()); var result = priceHistory.GetPrice(new Date(2000, 01, 01)); result.Should().Be(0.00m); }
public void UpdateClosingPricesEmptyList() { var priceHistory = new StockPriceHistory(Guid.NewGuid()); priceHistory.UpdateClosingPrice(new Date(2000, 01, 04), 11.00m); var result = priceHistory.GetPrice(new Date(2000, 01, 04)); result.Should().Be(11.00m); }
public void GetPriceExactMatch() { var priceHistory = new StockPriceHistory(Guid.NewGuid()); priceHistory.UpdateClosingPrice(new Date(2000, 08, 01), 4.00m); priceHistory.UpdateClosingPrice(new Date(2000, 01, 01), 10.00m); priceHistory.UpdateClosingPrice(new Date(2000, 05, 01), 6.00m); var result = priceHistory.GetPrice(new Date(2000, 01, 01)); result.Should().Be(10.00m); }
public void GetPriceCurrentDayWitoutCurrentPriceSet() { var priceHistory = new StockPriceHistory(Guid.NewGuid()); priceHistory.UpdateClosingPrice(new Date(2000, 08, 01), 4.00m); priceHistory.UpdateClosingPrice(new Date(2000, 01, 01), 10.00m); priceHistory.UpdateClosingPrice(new Date(2000, 05, 01), 6.00m); var result = priceHistory.GetPrice(Date.Today); result.Should().Be(4.00m); }
public void GetPriceBeforeFirstEntry() { var priceHistory = new StockPriceHistory(Guid.NewGuid()); priceHistory.UpdateClosingPrice(new Date(2000, 08, 01), 4.00m); priceHistory.UpdateClosingPrice(new Date(2000, 01, 01), 10.00m); priceHistory.UpdateClosingPrice(new Date(2000, 05, 01), 6.00m); priceHistory.UpdateCurrentPrice(15.00m); var result = priceHistory.GetPrice(new Date(1999, 02, 01)); result.Should().Be(0.00m); }
public void GetPriceInTheFuture() { var priceHistory = new StockPriceHistory(Guid.NewGuid()); priceHistory.UpdateClosingPrice(new Date(2000, 08, 01), 4.00m); priceHistory.UpdateClosingPrice(new Date(2000, 01, 01), 10.00m); priceHistory.UpdateClosingPrice(new Date(2000, 05, 01), 6.00m); priceHistory.UpdateCurrentPrice(15.00m); var result = priceHistory.GetPrice(Date.Today.AddDays(20)); result.Should().Be(15.00m); }
public void UpdateClosingPriceNoExistingEntryForDate() { var priceHistory = new StockPriceHistory(Guid.NewGuid()); priceHistory.UpdateClosingPrice(new Date(2000, 01, 01), 1.00m); priceHistory.UpdateClosingPrice(new Date(2000, 01, 03), 3.00m); priceHistory.UpdateClosingPrice(new Date(2000, 01, 05), 5.00m); priceHistory.UpdateClosingPrice(new Date(2000, 01, 04), 11.00m); var result = priceHistory.GetPrice(new Date(2000, 01, 04)); result.Should().Be(11.00m); }
public void UpdateClosingPriceCurrentPriceForDate() { var priceHistory = new StockPriceHistory(Guid.NewGuid()); priceHistory.UpdateClosingPrice(new Date(2000, 01, 01), 1.00m); priceHistory.UpdateClosingPrice(new Date(2000, 01, 03), 3.00m); priceHistory.UpdateClosingPrice(new Date(2000, 01, 05), 5.00m); priceHistory.UpdateCurrentPrice(10.00m); priceHistory.UpdateClosingPrice(Date.Today, 11.00m); var result = priceHistory.GetPrice(Date.Today); result.Should().Be(11.00m); }