Exemplo n.º 1
0
        public void Add_availability_invalid_price_null()
        {
            var calendar = new Calendar(1);

            Assert.ThrowsException <FantasticStayDomainException>(() =>
                                                                  calendar.AddAvailability(new DateTime(2020, 3, 1), new DateTime(2020, 3, 3), null));
        }
Exemplo n.º 2
0
        public void Add_availability_invalid_from_to()
        {
            var calendar = new Calendar(1);
            var price    = new Price(100, Currency.EUR.Id);

            Assert.ThrowsException <FantasticStayDomainException>(() =>
                                                                  calendar.AddAvailability(new DateTime(2020, 3, 3), new DateTime(2020, 3, 1), price));
        }
Exemplo n.º 3
0
        public void Add_availability_zero_price_success()
        {
            var calendar = new Calendar(1);
            var price    = new Price(0, Currency.EUR.Id);

            calendar.AddAvailability(new DateTime(2020, 3, 1), new DateTime(2020, 3, 3), price);

            Assert.AreEqual(1, calendar.Items.Count);
        }
Exemplo n.º 4
0
        public void Get_availability_valid()
        {
            var calendar = new Calendar(1);
            var price    = new Price(100, Currency.EUR.Id);

            calendar.AddAvailability(new DateTime(2020, 3, 1), new DateTime(2020, 3, 3), price);
            calendar.BlockDates(new DateTime(2020, 3, 2), new DateTime(2020, 3, 2));

            var actualResult   = calendar.GetAvailability(new DateTime(2020, 2, 1), new DateTime(2020, 4, 1)).ToList();
            var expectedResult = new Dictionary <DateTime, Price>
            {
                { new DateTime(2020, 3, 1), price },
                { new DateTime(2020, 3, 3), price }
            };

            CollectionAssert.AreEqual(expectedResult, actualResult);
        }