Example #1
0
        public ArrayList PayData(bool paymenthodwithcard)
        {
            if (paymenthodwithcard)
            {
                do
                {
                    WindowLogged("HOTEL HOLIDAY INN - RESERVACION: PAGO", 23);
                    Write("REGISTRO DEL METODO DE PAGO", 5, 7);
                    Write("Tipo de tarjeta (credito / debito): ", 5, 9);
                    PayDataVar.Insert(0, MoveRead(41, 9));

                    if (PayDataVar[0].ToString() != "credito" && PayDataVar[0].ToString() != "debito")
                    {
                        PopUp("Error: entrada incorrecta\nIngrese de nuevo", "ERROR");
                    }
                }while (PayDataVar[0].ToString() != "credito" && PayDataVar[0].ToString() != "debito");

                while (PaymentCardNumber.ToString().Length != 16)
                {
                    try {
                        WindowLogged("HOTEL HOLIDAY INN - RESERVACION: PAGO", 23);
                        Write("REGISTRO DEL METODO DE PAGO", 5, 7);
                        Write("Tipo de tarjeta (credito / debito): ", 5, 9);
                        Write(PayDataVar[0].ToString(), 41, 9);
                        Write("Numero de tarjeta: ", 5, 10);
                        PaymentCardNumber = Convert.ToInt64(MoveRead(24, 10));

                        if (PaymentCardNumber.ToString().Length != 16)
                        {
                            PopUp("Error: ingrese un numero valido\nIngrese de nuevo", "ERROR");
                        }
                    } catch (Exception e) {
                        PopUp("Error: " + e.Message + "\nIngrese de nuevo", "ERROR");
                    }
                }

                while (MM_YY_Of_Card.Length != 5)
                {
                    WindowLogged("HOTEL HOLIDAY INN - RESERVACION: PAGO", 23);
                    Write("REGISTRO DEL METODO DE PAGO", 5, 7);
                    Write("Tipo de tarjeta (credito / debito): ", 5, 9);
                    Write(PayDataVar[0].ToString(), 41, 9);
                    Write("Numero de tarjeta: ", 5, 10);
                    Write(PaymentCardNumber.ToString(), 24, 10);
                    Write("MM - YY de la tarjeta (MM/YY): ", 5, 11);
                    MM_YY_Of_Card = MoveRead(36, 11);

                    if (MM_YY_Of_Card.Length != 5)
                    {
                        PopUp("Error: ingrese un numero valido\nIngrese de nuevo", "ERROR");
                    }
                }

                while (CVC_Of_Card.ToString().Length != 3)
                {
                    try {
                        WindowLogged("HOTEL HOLIDAY INN - RESERVACION: PAGO", 23);
                        Write("REGISTRO DEL METODO DE PAGO", 5, 7);
                        Write("Tipo de tarjeta (credito / debito): ", 5, 9);
                        Write(PayDataVar[0].ToString(), 41, 9);
                        Write("Numero de tarjeta: ", 5, 10);
                        Write(PaymentCardNumber.ToString(), 24, 10);
                        Write("MM - YY de la tarjeta (MM/YY): ", 5, 11);
                        Write(MM_YY_Of_Card, 36, 11);

                        Write("CVC: ", 5, 12);
                        CVC_Of_Card = Convert.ToInt32(MoveRead(11, 12));

                        if (CVC_Of_Card.ToString().Length != 3)
                        {
                            PopUp("Error: ingrese un numero valido\nIngrese de nuevo", "ERROR");
                        }
                    } catch (Exception e) {
                        PopUp("Error: " + e.Message + "\nIngrese de nuevo", "ERROR");
                    }
                }
            }



            return(PayDataVar);
        }
        public void WhenNumberIsValid_ThenSetType(string number, PaymentCardType type)
        {
            var sut = new PaymentCardNumber(number);

            Assert.That(sut.Type, Is.EqualTo(type));
        }
 public void WhenNumberIsNull_ThenThrowException()
 {
     Assert.Throws <ArgumentException>(() => _ = new PaymentCardNumber(null));
 }
        public void WhenNumberDoesNotPassLuhnCheck_ThenSetFalse()
        {
            var sut = new PaymentCardNumber(TestPaymentCardNumbers.ValidUnknown);

            Assert.That(sut.PassedLuhnCheck, Is.False);
        }
        public void WhenNumberPassesLuhnCheck_ThenSetTrue()
        {
            var sut = new PaymentCardNumber(TestPaymentCardNumbers.ValidMasterCard);

            Assert.That(sut.PassedLuhnCheck, Is.True);
        }
        public void WhenNumberIsValid_ThenSetNumber()
        {
            var sut = new PaymentCardNumber(TestPaymentCardNumbers.ValidMasterCard);

            Assert.That(sut.Number, Is.EqualTo(TestPaymentCardNumbers.ValidMasterCard));
        }
 public void WhenNumberContainsNonDigits_ThenThrowException()
 {
     Assert.Throws <ArgumentException>(() => _ = new PaymentCardNumber("548594605X5343963"));
 }
 public void WhenNummberIsEmpty_ThenThrowException()
 {
     Assert.Throws <ArgumentException>(() => _ = new PaymentCardNumber(string.Empty));
 }