Exemple #1
0
        public MembershipOrder GetMembershipOrderForIndexModel(
            IndexModel indexModel,
            IOrderRepository orderRepository)
        {
            var membershipOrderFactory = new MembershipOrderFactory();

            var membershipOrder = membershipOrderFactory.CreateMembershipOrder();

            membershipOrder.FirstName    = indexModel.FirstName;
            membershipOrder.LastName     = indexModel.LastName;
            membershipOrder.EmailAddress = indexModel.EmailAddress;

            if (indexModel.DateOfBirth.HasValue)
            {
                membershipOrder.DateOfBirth = (DateTime)indexModel.DateOfBirth;
            }

            membershipOrder.CreditCardNumber = indexModel.CreditCardNumber;
            membershipOrder.CreditCardType   = CreditCardType.FromCode(indexModel.SelectedCreditCardType);
            membershipOrder.MembershipOffer  =
                orderRepository.GetMembershipOfferById(indexModel.SelectedMembershipOption);

            return(membershipOrder);
        }
Exemple #2
0
        public void FromCodeShouldReturnTheTargetValue()
        {
            var creditCardType = CreditCardType.FromCode("VISA");

            Assert.That(creditCardType, Is.EqualTo(CreditCardType.Visa));
        }