public CheckoutViewModelFactoryTests()
        {
            _cart = new FakeCart(new MarketImpl(new MarketId(Currency.USD)), Currency.USD);
            _cart.Forms.Single().Shipments.Single().LineItems.Add(new InMemoryLineItem());
            _cart.Forms.Single().CouponCodes.Add("couponcode");

            _cashPayment = new PaymentMethodViewModel<PaymentMethodBase> { SystemName = cashPaymentName };
            _creditPayment = new PaymentMethodViewModel<PaymentMethodBase> { SystemName = creditPaymentName };
            var paymentServiceMock = new Mock<IPaymentService>();
            var marketMock = new Mock<IMarket>();
            var currentMarketMock = new Mock<ICurrentMarket>();
            var languageServiceMock = new Mock<LanguageService>(null, null, null, null);
            var paymentMethodViewModelFactory = new PaymentMethodViewModelFactory(currentMarketMock.Object, languageServiceMock.Object, paymentServiceMock.Object);

            currentMarketMock.Setup(x => x.GetCurrentMarket()).Returns(marketMock.Object);
            languageServiceMock.Setup(x => x.GetCurrentLanguage()).Returns(new CultureInfo("en-US"));
            paymentServiceMock.Setup(x => x.GetPaymentMethodsByMarketIdAndLanguageCode(It.IsAny<string>(), "en")).Returns(
               new[]
               {
                    new PaymentMethodModel { Description = "Lorem ipsum", FriendlyName = "payment method 1", LanguageId = "en", PaymentMethodId = Guid.NewGuid(), SystemName = cashPaymentName },
                    new PaymentMethodModel { Description = "Lorem ipsum", FriendlyName = "payment method 2", LanguageId = "en", PaymentMethodId = Guid.NewGuid(), SystemName = creditPaymentName }
               });

            var addressBookServiceMock = new Mock<IAddressBookService>();
            addressBookServiceMock.Setup(x => x.List()).Returns(() => new List<AddressModel> { new AddressModel { AddressId = "addressid" } });
            _preferredBillingAddress = CustomerAddress.CreateInstance();
            _preferredBillingAddress.Name = "preferredBillingAddress";
            addressBookServiceMock.Setup(x => x.GetPreferredBillingAddress()).Returns(_preferredBillingAddress);
            addressBookServiceMock.Setup(x => x.UseBillingAddressForShipment()).Returns(true);

            _startPage = new StartPage();
            var contentLoaderMock = new Mock<IContentLoader>();
            contentLoaderMock.Setup(x => x.Get<StartPage>(It.IsAny<PageReference>())).Returns(_startPage);

            var orderFactoryMock = new Mock<IOrderFactory>();
            var urlResolverMock = new Mock<UrlResolver>();
            var httpcontextMock = new Mock<HttpContextBase>();
            var requestMock = new Mock<HttpRequestBase>();

            requestMock.Setup(x => x.Url).Returns(new Uri("http://site.com"));
            requestMock.Setup(x => x.UrlReferrer).Returns(new Uri("http://site.com"));
            httpcontextMock.Setup(x => x.Request).Returns(requestMock.Object);

            Func<CultureInfo> func = () => CultureInfo.InvariantCulture;
            var shipmentViewModelFactoryMock = new Mock<ShipmentViewModelFactory>(null, null, null, null, null, null, func, null);
            shipmentViewModelFactoryMock.Setup(x => x.CreateShipmentsViewModel(It.IsAny<ICart>())).Returns(() => new[]
            {
                new ShipmentViewModel {
                    CartItems = new[]
                    {
                        new CartItemViewModel { Quantity = 1 }
                    }
                }
            });

            _subject = new CheckoutViewModelFactory(
                new MemoryLocalizationService(),
                paymentMethodViewModelFactory,
                addressBookServiceMock.Object,
                contentLoaderMock.Object,
                orderFactoryMock.Object,
                urlResolverMock.Object,
                (() => httpcontextMock.Object),
                shipmentViewModelFactoryMock.Object);
        }
 public CheckoutControllerForTest(
     IContentRepository contentRepository,
     IMailService mailService,
     LocalizationService localizationService,
     ICurrencyService currencyService,
     ControllerExceptionHandler controllerExceptionHandler,
     CustomerContextFacade customerContextFacade,
     IOrderRepository orderRepository,
     CheckoutViewModelFactory checkoutViewModelFactory,
     IOrderGroupCalculator orderGroupCalculator,
     IPaymentProcessor paymentProcessor,
     IPromotionEngine promotionEngine,
     ICartService cartService,
     IAddressBookService addressBookService,
     OrderSummaryViewModelFactory orderSummaryViewModelFactory,
     IOrderFactory orderFactory
     )
     : base(contentRepository,
           mailService,
           localizationService,
           currencyService,
           controllerExceptionHandler,
           customerContextFacade,
           orderRepository,
           checkoutViewModelFactory,
           orderGroupCalculator,
           paymentProcessor,
           promotionEngine,
           cartService,
           addressBookService,
           orderSummaryViewModelFactory,
           orderFactory)
 {
 }