public CheckoutViewModelFactory(
     LocalizationService localizationService,
     PaymentMethodViewModelFactory paymentMethodViewModelFactory,
     IAddressBookService addressBookService,
     IContentLoader contentLoader,
     UrlResolver urlResolver,
     ServiceAccessor <HttpContextBase> httpContextAccessor,
     ShipmentViewModelFactory shipmentViewModelFactory,
     ICustomerService customerService,
     IOrganizationService organizationService,
     IBudgetService budgetService,
     ICustomerService customerContext)
 {
     _localizationService           = localizationService;
     _paymentMethodViewModelFactory = paymentMethodViewModelFactory;
     _addressBookService            = addressBookService;
     _contentLoader            = contentLoader;
     _urlResolver              = urlResolver;
     _httpContextAccessor      = httpContextAccessor;
     _shipmentViewModelFactory = shipmentViewModelFactory;
     _customerService          = customerService;
     _organizationService      = organizationService;
     _budgetService            = budgetService;
     _customerContext          = customerContext;
 }
        public DefaultCartController(
            ICartService cartService,
            IOrderRepository orderRepository,
            ICommerceTrackingService recommendationService,
            CartViewModelFactory cartViewModelFactory,
            IContentLoader contentLoader,
            IContentRouteHelper contentRouteHelper,
            ReferenceConverter referenceConverter,
            IQuickOrderService quickOrderService,
            ICustomerService customerService,
            ShipmentViewModelFactory shipmentViewModelFactory,
            CheckoutService checkoutService,
            IOrderGroupCalculator orderGroupCalculator,
            CartItemViewModelFactory cartItemViewModelFactory,
            IProductService productService,
            LanguageResolver languageResolver)

        {
            _cartService              = cartService;
            _orderRepository          = orderRepository;
            _recommendationService    = recommendationService;
            _cartViewModelFactory     = cartViewModelFactory;
            _contentLoader            = contentLoader;
            _contentRouteHelper       = contentRouteHelper;
            _referenceConverter       = referenceConverter;
            _quickOrderService        = quickOrderService;
            _customerService          = customerService;
            _shipmentViewModelFactory = shipmentViewModelFactory;
            _checkoutService          = checkoutService;
            _orderGroupCalculator     = orderGroupCalculator;
            _cartItemViewModelFactory = cartItemViewModelFactory;
            _productService           = productService;
            _languageResolver         = languageResolver;
        }
        public ShipmentViewModelFactoryTests()
        {
            var market = new MarketImpl(new MarketId(Currency.USD));

            _cart = new FakeCart(market, Currency.USD)
            {
                Name = "Default"
            };
            _cart.Forms.Single().Shipments.Single().LineItems.Add(new InMemoryLineItem {
                Code = "code"
            });
            _cart.Forms.Single().CouponCodes.Add("couponcode");

            _shippingManagerFacadeMock = new Mock <ShippingManagerFacade>(null, null);
            _shippingManagerFacadeMock.Setup(x => x.GetShippingMethodsByMarket(It.IsAny <string>(), It.IsAny <bool>())).Returns(() => new List <ShippingMethodInfoModel>
            {
                new ShippingMethodInfoModel
                {
                    LanguageId = CultureInfo.InvariantCulture.TwoLetterISOLanguageName,
                    Currency   = Currency.USD
                }
            });
            _shippingRate = new ShippingRate(Guid.NewGuid(), "name", new Money(10, Currency.USD));
            _shippingManagerFacadeMock.Setup(x => x.GetRate(It.IsAny <IShipment>(), It.IsAny <ShippingMethodInfoModel>(), It.IsAny <IMarket>()))
            .Returns(_shippingRate);

            var languageServiceMock = new Mock <LanguageService>(null, null, null);

            languageServiceMock.Setup(x => x.GetCurrentLanguage()).Returns(CultureInfo.InvariantCulture);

            var addressBookServiceMock = new Mock <IAddressBookService>();

            _addressModel = new AddressModel();
            addressBookServiceMock.Setup(x => x.ConvertToModel(It.IsAny <IOrderAddress>())).Returns(_addressModel);

            _cartItem = new CartItemViewModel();
            var cartItemViewModelFactoryMock = new Mock <CartItemViewModelFactory>(null, null, null, null, null, null);

            cartItemViewModelFactoryMock.Setup(x => x.CreateCartItemViewModel(It.IsAny <ICart>(), It.IsAny <ILineItem>(), It.IsAny <VariationContent>())).Returns(_cartItem);

            var catalogContentServiceMock = new Mock <CatalogContentService>(null, null, null, null, null, null, null);

            catalogContentServiceMock.Setup(x => x.GetItems <EntryContentBase>(It.IsAny <IEnumerable <string> >()))
            .Returns(() => new List <VariationContent> {
                new VariationContent {
                    Code = "code"
                }
            });

            _marketServiceMock = new Mock <IMarketService>();
            _marketServiceMock.Setup(x => x.GetMarket(It.IsAny <MarketId>())).Returns(market);
            _subject = new ShipmentViewModelFactory(
                catalogContentServiceMock.Object,
                _shippingManagerFacadeMock.Object,
                languageServiceMock.Object,
                addressBookServiceMock.Object,
                cartItemViewModelFactoryMock.Object,
                _marketServiceMock.Object);
        }
 public MultiShipmentViewModelFactory(
     LocalizationService localizationService,
     IAddressBookService addressBookService,
     UrlResolver urlResolver,
     ServiceAccessor <HttpContextBase> httpContextAccessor,
     ShipmentViewModelFactory shipmentViewModelFactory)
 {
     _localizationService      = localizationService;
     _addressBookService       = addressBookService;
     _urlResolver              = urlResolver;
     _httpContextAccessor      = httpContextAccessor;
     _shipmentViewModelFactory = shipmentViewModelFactory;
 }
Exemple #5
0
 public CheckoutViewModelFactory(
     LocalizationService localizationService,
     ServiceAccessor <PaymentMethodViewModelFactory> paymentMethodViewModelFactory,
     IAddressBookService addressBookService,
     IContentLoader contentLoader,
     UrlResolver urlResolver,
     ServiceAccessor <HttpContextBase> httpContextAccessor,
     ShipmentViewModelFactory shipmentViewModelFactory)
 {
     _localizationService           = localizationService;
     _paymentMethodViewModelFactory = paymentMethodViewModelFactory;
     _addressBookService            = addressBookService;
     _contentLoader            = contentLoader;
     _urlResolver              = urlResolver;
     _httpContextAccessor      = httpContextAccessor;
     _shipmentViewModelFactory = shipmentViewModelFactory;
 }
Exemple #6
0
 public CheckoutController(IPageRouteHelper pageRouteHelper,
                           IOrderRepository orderRepository,
                           CheckoutViewModelFactory checkoutViewModelFactory,
                           ICartService cartService,
                           OrderSummaryViewModelFactory orderSummaryViewModelFactory,
                           ICommerceTrackingService recommendationService,
                           CheckoutService checkoutService,
                           UrlHelper urlHelper,
                           ApplicationSignInManager <SiteUser> applicationSignInManager,
                           LocalizationService localizationService,
                           IAddressBookService addressBookService,
                           MultiShipmentViewModelFactory multiShipmentViewModelFactory,
                           IOrderGroupFactory orderGroupFactory,
                           IContentLoader contentLoader,
                           UrlResolver urlResolver,
                           ICustomerService customerContext,
                           IOrganizationService organizationService,
                           ShipmentViewModelFactory shipmentViewModelFactory,
                           IGiftCardService giftCardService,
                           ISettingsService settingsService)
 {
     _pageRouteHelper          = pageRouteHelper;
     _orderRepository          = orderRepository;
     _checkoutViewModelFactory = checkoutViewModelFactory;
     _cartService = cartService;
     _orderSummaryViewModelFactory = orderSummaryViewModelFactory;
     _recommendationService        = recommendationService;
     _checkoutService               = checkoutService;
     _urlHelper                     = urlHelper;
     _applicationSignInManager      = applicationSignInManager;
     _localizationService           = localizationService;
     _addressBookService            = addressBookService;
     _multiShipmentViewModelFactory = multiShipmentViewModelFactory;
     _orderGroupFactory             = orderGroupFactory;
     _contentLoader                 = contentLoader;
     _urlResolver                   = urlResolver;
     _customerContext               = customerContext;
     _organizationService           = organizationService;
     _shipmentViewModelFactory      = shipmentViewModelFactory;
     _giftCardService               = giftCardService;
     _settingsService               = settingsService;
 }
 public CartViewModelFactory(
     IContentLoader contentLoader,
     ICurrencyService currencyService,
     IOrderGroupCalculator orderGroupCalculator,
     ShipmentViewModelFactory shipmentViewModelFactory,
     ReferenceConverter referenceConverter,
     UrlResolver urlResolver,
     IHttpContextAccessor httpContextAccessor,
     IAddressBookService addressBookService,
     ISettingsService settingsService)
 {
     _contentLoader = contentLoader;
     _currencyService = currencyService;
     _orderGroupCalculator = orderGroupCalculator;
     _shipmentViewModelFactory = shipmentViewModelFactory;
     _referenceConverter = referenceConverter;
     _urlResolver = urlResolver;
     _httpContextAccessor = httpContextAccessor;
     _addressBookService = addressBookService;
     _settingsService = settingsService;
 }
 public ShippingOptionController(
     IContentRepository contentRepository,
     ReferenceConverter referenceConverter,
     IPricingService pricingService,
     UrlResolver urlResolver,
     CatalogContentService catalogContentService,
     CatalogEntryViewModelFactory catalogEntryViewModelFactory,
     ISiteDefinitionRepository siteDefinitionRepository,
     IWarehouseService warehouseService,
     ShipmentViewModelFactory shipmentViewModelFactory,
     IMarketService marketService)
 {
     _contentRepository            = contentRepository;
     _referenceConverter           = referenceConverter;
     _pricingService               = pricingService;
     _urlResolver                  = urlResolver;
     _catalogContentService        = catalogContentService;
     _catalogEntryViewModelFactory = catalogEntryViewModelFactory;
     _siteDefinitionRepository     = siteDefinitionRepository;
     _warehouseService             = warehouseService;
     _shipmentViewModelFactory     = shipmentViewModelFactory;
     _marketService                = marketService;
 }
Exemple #9
0
        public ShipmentViewModelFactoryTests()
        {
            _cart = new FakeCart(new MarketImpl(new MarketId(Currency.USD)), Currency.USD)
            {
                Name = "Default"
            };
            _cart.Forms.Single().Shipments.Single().LineItems.Add(new InMemoryLineItem {
                Code = "code"
            });
            _cart.Forms.Single().CouponCodes.Add("couponcode");

            _shippingManagerFacadeMock = new Mock <ShippingManagerFacade>();
            _shippingManagerFacadeMock.Setup(x => x.GetShippingMethodsByMarket(It.IsAny <string>(), It.IsAny <bool>())).Returns(() => new List <ShippingMethodInfoModel>
            {
                new ShippingMethodInfoModel
                {
                    LanguageId = CultureInfo.InvariantCulture.TwoLetterISOLanguageName,
                    Currency   = Currency.USD
                }
            });
            _shippingRate = new ShippingRate(Guid.NewGuid(), "name", new Money(10, Currency.USD));
            _shippingManagerFacadeMock.Setup(x => x.GetRate(It.IsAny <IShipment>(), It.IsAny <ShippingMethodInfoModel>(), It.IsAny <IMarket>()))
            .Returns(_shippingRate);

            var languageServiceMock = new Mock <LanguageService>(null, null, null);

            languageServiceMock.Setup(x => x.GetCurrentLanguage()).Returns(CultureInfo.InvariantCulture);

            var referenceConverterMock = new Mock <ReferenceConverter>(null, null);

            var addressBookServiceMock = new Mock <IAddressBookService>();

            _addressModel = new AddressModel();
            addressBookServiceMock.Setup(x => x.ConvertToModel(It.IsAny <IOrderAddress>())).Returns(_addressModel);

            _cartItem = new CartItemViewModel();
            var cartItemViewModelFactoryMock = new Mock <CartItemViewModelFactory>(null, null, null, null, null, null, null, null, null, null, null);

            cartItemViewModelFactoryMock.Setup(x => x.CreateCartItemViewModel(It.IsAny <ICart>(), It.IsAny <ILineItem>(), It.IsAny <VariationContent>())).Returns(_cartItem);

            var contentLoaderMock = new Mock <IContentLoader>();

            contentLoaderMock.Setup(x => x.GetItems(It.IsAny <IEnumerable <ContentReference> >(), It.IsAny <CultureInfo>()))
            .Returns(() => new List <VariationContent> {
                new VariationContent {
                    Code = "code"
                }
            });

            var relationRepositoryMock = new Mock <IRelationRepository>();

            relationRepositoryMock.Setup(x => x.GetRelationsByTarget <ProductVariation>(It.IsAny <ContentReference>()))
            .Returns(() => new[] { new ProductVariation {
                                       Source = new ContentReference(1)
                                   } });

            _languageResolverMock = new Mock <LanguageResolver>();
            _languageResolverMock.Setup(x => x.GetPreferredCulture()).Returns(CultureInfo.GetCultureInfo("en"));

            _subject = new ShipmentViewModelFactory(
                contentLoaderMock.Object,
                _shippingManagerFacadeMock.Object,
                languageServiceMock.Object,
                referenceConverterMock.Object,
                addressBookServiceMock.Object,
                cartItemViewModelFactoryMock.Object,
                _languageResolverMock.Object,
                relationRepositoryMock.Object);
        }