示例#1
0
        public void ValidateCustomerWithCheckPayment()
        {
            TransactionalInformation transaction;

            CustomerApplicationService customerApplicationService = new CustomerApplicationService(customerDataService);
            List <PaymentType>         paymentTypes = customerApplicationService.GetPaymentTypes(out transaction);

            var paymentType = (from p in paymentTypes where p.Description == "Check" select p).First();

            Customer customer = new Customer();

            customer.FirstName     = "Bill";
            customer.LastName      = "Gates";
            customer.EmailAddress  = "*****@*****.**";
            customer.PhoneNumber   = "15976111157";
            customer.PaymentTypeID = paymentType.PaymentTypeID;
            customer.CreditLimit   = 1000.00m;

            customerDataService.CreateSession();
            CustomerBusinessRules customerBusinessRules = new CustomerBusinessRules();

            customerBusinessRules.ValidateCustomer(customer, customerDataService);
            customerDataService.CloseSession();

            string returnMessage = Utilities.GetReturnMessage(customerBusinessRules.ValidationMessage);

            Assert.AreEqual(true, customerBusinessRules.ValidationStatus, returnMessage);
        }
示例#2
0
        public void ValidateCustomerWithCreditCardPayment()
        {
            TransactionalInformation transaction;

            CustomerApplicationService customerApplicationService = new CustomerApplicationService(customerDataService);
            List <PaymentType>         paymentTypes = customerApplicationService.GetPaymentTypes(out transaction);

            var paymentType = (from p in paymentTypes where p.Description == "Visa" select p).First();

            Customer customer = new Customer();

            customer.FirstName                = "Bill";
            customer.LastName                 = "Gates";
            customer.EmailAddress             = "*****@*****.**";
            customer.PhoneNumber              = "15976111157";
            customer.PaymentTypeID            = paymentType.PaymentTypeID;
            customer.CreditCardNumber         = "1112223333";
            customer.CreditCardExpirationDate = Convert.ToDateTime("12/31/2014");
            customer.CreditCardSecurityCode   = "111";

            customerDataService.CreateSession();
            CustomerBusinessRules customerBusinessRules = new CustomerBusinessRules();

            customerBusinessRules.ValidateCustomer(customer, customerDataService);
            customerDataService.CloseSession();

            string returnMessage = Utilities.GetReturnMessage(customerBusinessRules.ValidationMessage);

            Assert.AreEqual(true, customerBusinessRules.ValidationStatus, returnMessage);
        }