示例#1
0
        public void TypeRentConstructorTest()
        {
            TimeEnum time     = TimeEnum.Hour;
            TypeRent typeRent = new TypeRent(time);

            Assert.IsNotNull(typeRent);
        }
示例#2
0
        /// <summary>
        /// Create and SetDates of and Rent
        /// </summary>
        /// <param name="endRent">Finish date of rent</param>
        /// <param name="type">Type of rent to create</param>
        /// <returns>Instance of Rent</returns>
        private void CreateRent(DateTime endRent, TypeRent type)
        {
            var startRent = new DateTime(2017, 10, 01, 09, 15, 25);

            instance = RentFactory.CreateInstance(type);
            instance.SetRentDates(startRent, endRent);
        }
示例#3
0
        public void TotalPriceWithDiscountTest()
        {
            int    dni    = 23456765;
            string name   = "Juan Lopez";
            Client client = new Client(dni, name);

            TypeRent hour     = new TypeRent(TimeEnum.Hour);
            Rent     rentHour = new Rent(hour, 3);

            client.rents.Add(rentHour);

            TypeRent day     = new TypeRent(TimeEnum.Day);
            Rent     rentDay = new Rent(day, 2);

            client.rents.Add(rentDay);

            TypeRent week     = new TypeRent(TimeEnum.Week);
            Rent     rentWeek = new Rent(week, 1);

            client.rents.Add(rentWeek);

            double expected = 80.5;
            double actual;

            actual = client.TotalPrice();
            Assert.AreEqual(expected, actual);
        }
示例#4
0
        public void RentConstructorTest()
        {
            TypeRent typeRent   = new TypeRent(TimeEnum.Day);
            double   amountTime = 2;
            Rent     rent       = new Rent(typeRent, amountTime);

            Assert.IsNotNull(rent);
        }
示例#5
0
 public Contract(string contractid, string licensePlates, Customer customer, string startDate, string endDate, int cost, string payments, TypePayment typepayment, TypeRent typeRent)
 {
     this.contractid    = contractid;
     this.licensePlates = licensePlates;
     this.customer      = customer;
     this.startDate     = startDate;
     this.endDate       = endDate;
     this.cost          = cost;
     this.payments      = payments;
     this.typepayment   = typepayment;
     this.typeRent      = typeRent;
 }
示例#6
0
        public void TotalPriceByDayTest()
        {
            int    dni    = 23456765;
            string name   = "Juan Lopez";
            Client client = new Client(dni, name);

            TypeRent day     = new TypeRent(TimeEnum.Day);
            Rent     rentDay = new Rent(day, 4);

            client.rents.Add(rentDay);

            double expected = 80;
            double actual;

            actual = client.TotalPrice();
            Assert.AreEqual(expected, actual);
        }
示例#7
0
        public void TotalPriceByWeekTest()
        {
            int    dni    = 23456765;
            string name   = "Juan Lopez";
            Client client = new Client(dni, name);

            TypeRent week     = new TypeRent(TimeEnum.Week);
            Rent     rentWeek = new Rent(week, 4);

            client.rents.Add(rentWeek);

            double expected = 240;
            double actual;

            actual = client.TotalPrice();
            Assert.AreEqual(expected, actual);
        }
示例#8
0
        public static IRent CreateInstance(TypeRent typeRent)
        {
            IRent instance = null;

            switch (typeRent)
            {
            case TypeRent.Hour:
                instance = RentHour.GetInstance();
                break;

            case TypeRent.Day:
                instance = RentDay.GetInstance();
                break;

            case TypeRent.Week:
                instance = RentWeek.GetInstance();
                break;
            }
            return(instance);
        }
示例#9
0
 public void AddRent(TypeRent rent)
 {
     Rents.Add(RentFactory.CreateInstance(rent));
 }