public void ShouldReturnTodayPrice_Test()
        {
            var today      = DateTime.Today;
            var volatility = 0d;
            var todayPrice = 100d;

            var pricer = new MiniPricer();
            var price  = pricer.CalculatePrice(today, todayPrice, volatility);

            Assert.AreEqual(todayPrice, price);
        }
        public void ShouldReturnPriceWhenSaturdayAndSundayAreInTheMiddle_Test()
        {
            Mock <IPublicHolidayProvider> moqPublicHolidayProvider = new Mock <IPublicHolidayProvider>();

            moqPublicHolidayProvider.Setup(p => p.GetPublicHolidays()).Returns(Enumerable.Empty <DateTime>());
            moqPublicHolidayProvider.Setup(p => p.IsPublicHoliday(It.IsAny <DateTime>())).Returns(false);
            var futurDate  = new DateTime(2017, 10, 16);
            var volatility = 50d;
            var todayPrice = 800d;

            var pricer = new MiniPricer(moqPublicHolidayProvider.Object);
            var price  = pricer.CalculatePrice(futurDate, todayPrice, volatility);

            Assert.AreEqual(4050, price);
        }
        public void ShouldReturnMoreThanOneDayFuturPrice_Test()
        {
            Mock <IPublicHolidayProvider> moqPublicHolidayProvider = new Mock <IPublicHolidayProvider>();

            moqPublicHolidayProvider.Setup(p => p.GetPublicHolidays()).Returns(Enumerable.Empty <DateTime>());
            moqPublicHolidayProvider.Setup(p => p.IsPublicHoliday(It.IsAny <DateTime>())).Returns(false);
            var futurDate  = DateTime.Today.AddDays(2);
            var volatility = 50d;
            var todayPrice = 200d;

            var pricer = new MiniPricer(moqPublicHolidayProvider.Object);
            var price  = pricer.CalculatePrice(futurDate, todayPrice, volatility);

            Assert.AreEqual(450, price);
        }
        public void ShouldReturnPriceForPublicHolidayEqualSunday_Test()
        {
            Mock <IPublicHolidayProvider> moqPublicHolidayProvider = new Mock <IPublicHolidayProvider>();
            var testDate   = new DateTime(2017, 10, 15);
            var volatility = 50d;
            var todayPrice = 800d;

            moqPublicHolidayProvider.Setup(p => p.GetPublicHolidays()).Returns(new List <DateTime> {
                testDate
            });
            moqPublicHolidayProvider.Setup(p => p.IsPublicHoliday(testDate)).Returns(true);

            var pricer = new MiniPricer(moqPublicHolidayProvider.Object);
            var price  = pricer.CalculatePrice(testDate, todayPrice, volatility);

            Assert.AreEqual(2700, price);
        }
        public void ShouldReturnPriceForPublicHoliday_Test()
        {
            Mock <IPublicHolidayProvider> moqPublicHolidayProvider = new Mock <IPublicHolidayProvider>();

            moqPublicHolidayProvider.Setup(p => p.GetPublicHolidays()).Returns(new List <DateTime>()
            {
                DateTime.Today.AddDays(2)
            });
            moqPublicHolidayProvider.Setup(p => p.IsPublicHoliday(DateTime.Today.AddDays(2))).Returns(true);
            DateTime futurDate  = moqPublicHolidayProvider.Object.GetPublicHolidays().FirstOrDefault();
            var      volatility = 50d;
            var      todayPrice = 200d;

            var pricer = new MiniPricer(moqPublicHolidayProvider.Object);
            var price  = pricer.CalculatePrice(futurDate, todayPrice, volatility);

            Assert.AreEqual(300, price);
        }