Beispiel #1
0
        public void CalculatePriceIfFlightDayIsSaturdayAndDateDifferenceIs_3_Months()
        {
            //arrange
            string flightDate        = "2018-04-14";
            EconomyTicketMachine etm = new EconomyTicketMachine("EALOAHKG2b", flightDate);
            double expectedPrice     = 149.5;

            etm.Price = 100;

            //actual
            double actual = etm.calculatePrice("2018-01-01");

            //assert
            Assert.AreEqual(expectedPrice, actual);
        }
Beispiel #2
0
        public void CalculatePriceIfDateDifferenceIsMore_6_Months()
        {
            //arrange
            string flightDate        = "2018-10-11";
            EconomyTicketMachine etm = new EconomyTicketMachine("EALOAHKG2b", flightDate);
            double expectedPrice     = 100;

            etm.Price = 100;

            //actual
            double actual = etm.calculatePrice("2018-01-01");

            //assert
            Assert.AreEqual(expectedPrice, actual);
        }
Beispiel #3
0
        public void CalculatePriceWithOccupancyRateBetween_26_50_percent_OnEconomyClass()
        {
            //arrange
            string flightDate        = "2018-04-04";
            string buyingDate        = "2018-01-01";
            EconomyTicketMachine etm = new EconomyTicketMachine("EALOAHKG2", flightDate);

            etm.Price = 100;
            int tickets = 3;

            etm.ConstnumberOfTickets = 10;
            //OccupancyRate 30%
            etm.setNumberOfSoldTickets(tickets);
            etm.checkPlaneOccupancy();
            double expected = 143;

            //actual
            double actual = etm.calculatePrice(buyingDate);

            //assert
            Assert.AreEqual(expected, actual);
        }
Beispiel #4
0
 public void SetUp()
 {
     etm = new EconomyTicketMachine("EATLLTYO5", "2017-05-29");
 }