示例#1
0
        public void UpdateCurrentPriceExistingEntryForDate()
        {
            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.UpdateCurrentPrice(11.00m);

            var result = priceHistory.GetPrice(Date.Today);

            result.Should().Be(11.00m);
        }
示例#2
0
        public void GetPriceCurrentDay()
        {
            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);

            result.Should().Be(15.00m);
        }
示例#3
0
        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);
        }