Exemple #1
0
        public void TotalPriceTest3()
        {
            //arrange
            List <Person>  guests = new List <Person>();
            Client         client = new Client(1, "Marry", "Edinburgh");
            GuestDecorator guest  = new GuestDecorator("XYZ987456", 25);

            guest.SetComponent(client);
            guests.Add(guest);
            double  expectedAmount = 580;
            Booking booking        = new Booking(1, DateTime.Today, DateTime.Today.Add(TimeSpan.FromDays(4)),
                                                 client, guests, 2);
            EveningMealDecorator eveningMeal = new EveningMealDecorator();

            eveningMeal.SetComponent(booking);
            CarHireDecorator carHireDecorator = new CarHireDecorator();

            carHireDecorator.StartDate = DateTime.Today;
            carHireDecorator.EndDate   = DateTime.Today.Add(TimeSpan.FromDays(4));
            carHireDecorator.SetComponent(eveningMeal);


            // act
            double actualAmount = carHireDecorator.TotalPriece();

            //assert
            Assert.AreEqual(expectedAmount, actualAmount, 0, "TotalPrice method working properly");
        }
Exemple #2
0
        public void TotalPriceTest2()
        {
            //arrange
            List <Person> guests = new List <Person>();
            Person        person = new Person();

            person.Name = "John";
            GuestDecorator guest1 = new GuestDecorator("ABC123456", 21);

            guest1.SetComponent(person);
            guests.Add(guest1);
            Client         client = new Client(1, "Marry", "Edinburgh");
            GuestDecorator guest  = new GuestDecorator("XYZ987456", 25);

            guest.SetComponent(client);
            guests.Add(guest);
            double  expectedAmount = 390;
            Booking booking        = new Booking(1, DateTime.Today, DateTime.Today.Add(TimeSpan.FromDays(3)),
                                                 client, guests, 2);
            EveningMealDecorator eveningMeal = new EveningMealDecorator();

            eveningMeal.SetComponent(booking);


            // act
            double actualAmount = eveningMeal.TotalPriece();

            //assert
            Assert.AreEqual(expectedAmount, actualAmount, 0, "TotalPrice method working properly");
        }
Exemple #3
0
        public void NightCountTest()
        {
            //arrange
            List <Person> guests = new List <Person>();

            Client         client = new Client(1, "Marry", "Edinburgh");
            GuestDecorator guest  = new GuestDecorator("XYZ987456", 25);

            guest.SetComponent(client);
            guests.Add(guest);
            int     expectedCount = 6;
            Booking booking       = new Booking(1, DateTime.Today, DateTime.Today.Add(TimeSpan.FromDays(6)),
                                                client, guests, 2);
            EveningMealDecorator eveningMeal = new EveningMealDecorator();

            eveningMeal.SetComponent(booking);

            //act
            int actualCount = eveningMeal.NightCount();

            //assert
            Assert.AreEqual(expectedCount, actualCount, 0, "NightCount method not working properly");
        }