示例#1
0
        public void GetPriceEmptyList()
        {
            var priceHistory = new StockPriceHistory(Guid.NewGuid());

            var result = priceHistory.GetPrice(new Date(2000, 01, 01));

            result.Should().Be(0.00m);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
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);
        }
示例#6
0
        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);
        }
示例#7
0
        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);
        }
示例#8
0
        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);
        }