public ProductController( IPromotionService promotionService, IContentLoader contentLoader, IPriceService priceService, ICurrentMarket currentMarket, CurrencyService currencyservice, IRelationRepository relationRepository, AppContextFacade appContext, UrlResolver urlResolver, FilterPublished filterPublished, PreferredCultureAccessor preferredCultureAccessor, IsInEditModeAccessor isInEditModeAccessor, IQuickOrderService quickOrderService) { _promotionService = promotionService; _contentLoader = contentLoader; _priceService = priceService; _currentMarket = currentMarket; _currencyservice = currencyservice; _relationRepository = relationRepository; _appContext = appContext; _urlResolver = urlResolver; _preferredCulture = preferredCultureAccessor(); _isInEditMode = isInEditModeAccessor(); _filterPublished = filterPublished; _quickOrderService = quickOrderService; }
public FilterOptionViewModelBinder(IContentLoader contentLoader, LocalizationService localizationService, PreferredCultureAccessor preferredCulture) { _contentLoader = contentLoader; _localizationService = localizationService; _preferredCulture = preferredCulture(); }
public FilterOptionViewModelBinder(IContentLoader contentLoader, LocalizationService localizationService, PreferredCultureAccessor preferredCulture) { _contentLoader = contentLoader; _localizationService = localizationService; _preferredCulture = preferredCulture(); }
public CartViewModelFactoryTests() { _cart = new FakeCart(new MarketImpl(MarketId.Default), Currency.USD); _cart.Forms.Single().Shipments.Single().LineItems.Add(new InMemoryLineItem { Quantity = 1, PlacedPrice = 105, LineItemDiscountAmount = 5 }); _startPage = new StartPage() { CheckoutPage = new ContentReference(1), WishListPage = new ContentReference(1) }; var contentLoaderMock = new Mock <IContentLoader>(); contentLoaderMock.Setup(x => x.Get <StartPage>(It.IsAny <ContentReference>())).Returns(_startPage); PreferredCultureAccessor accessor = () => CultureInfo.InvariantCulture; var shipmentViewModelFactoryMock = new Mock <ShipmentViewModelFactory>(null, null, null, null, null, null, accessor, null); _cartItems = new List <CartItemViewModel> { new CartItemViewModel { DiscountedPrice = new Money(100, Currency.USD), Quantity = 1 } }; shipmentViewModelFactoryMock.Setup(x => x.CreateShipmentsViewModel(It.IsAny <ICart>())).Returns(() => new[] { new ShipmentViewModel { CartItems = _cartItems } }); var currencyServiceMock = new Mock <ICurrencyService>(); currencyServiceMock.Setup(x => x.GetCurrentCurrency()).Returns(Currency.USD); _totals = new OrderGroupTotals( new Money(100, Currency.USD), new Money(100, Currency.USD), new Money(100, Currency.USD), new Money(100, Currency.USD), new Money(100, Currency.USD), new Dictionary <IOrderForm, OrderFormTotals>()); var orderGroupTotalsCalculatorMock = new Mock <IOrderGroupTotalsCalculator>(); orderGroupTotalsCalculatorMock.Setup(x => x.GetTotals(It.IsAny <ICart>())).Returns(_totals); _orderDiscountTotal = new Money(5, Currency.USD); var orderGroupCalculatorMock = new Mock <IOrderGroupCalculator>(); orderGroupCalculatorMock.Setup(x => x.GetOrderDiscountTotal(It.IsAny <IOrderGroup>(), It.IsAny <Currency>())) .Returns(_orderDiscountTotal); orderGroupCalculatorMock.Setup(x => x.GetSubTotal(_cart)).Returns(new Money(_cart.GetAllLineItems().Sum(x => x.PlacedPrice * x.Quantity - ((ILineItemDiscountAmount)x).EntryAmount), _cart.Currency)); _subject = new CartViewModelFactory( contentLoaderMock.Object, currencyServiceMock.Object, orderGroupTotalsCalculatorMock.Object, orderGroupCalculatorMock.Object, shipmentViewModelFactoryMock.Object); }
public MultiShipmentViewModelFactoryTests() { _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"); var addressBookServiceMock = new Mock <IAddressBookService>(); addressBookServiceMock.Setup(x => x.List()).Returns(() => new List <AddressModel> { new AddressModel { AddressId = "addressid" } }); var 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 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); PreferredCultureAccessor accessor = () => CultureInfo.InvariantCulture; var shipmentViewModelFactoryMock = new Mock <ShipmentViewModelFactory>(null, null, null, null, null, null, accessor, null); shipmentViewModelFactoryMock.Setup(x => x.CreateShipmentsViewModel(It.IsAny <ICart>())).Returns(() => new[] { new ShipmentViewModel { CartItems = new[] { new CartItemViewModel { Quantity = 1 } } } }); _subject = new MultiShipmentViewModelFactory( new MemoryLocalizationService(), addressBookServiceMock.Object, contentLoaderMock.Object, urlResolverMock.Object, (() => httpcontextMock.Object), shipmentViewModelFactoryMock.Object); }
public SearchService(ICurrentMarket currentMarket, ICurrencyService currencyService, UrlResolver urlResolver, SearchFacade search, PreferredCultureAccessor preferredCulture, IContentLoader contentLoader, LocalizationService localizationService) { _search = search; _currentMarket = currentMarket; _currencyService = currencyService; _urlResolver = urlResolver; _preferredCulture = preferredCulture(); _contentLoader = contentLoader; _localizationService = localizationService; }
public SearchService(ICurrentMarket currentMarket, ICurrencyService currencyService, UrlResolver urlResolver, SearchFacade search, PreferredCultureAccessor preferredCulture, IContentLoader contentLoader, LocalizationService localizationService) { _search = search; _currentMarket = currentMarket; _currencyService = currencyService; _urlResolver = urlResolver; _preferredCulture = preferredCulture(); _contentLoader = contentLoader; _localizationService = localizationService; }
public ShipmentViewModelFactory( IContentLoader contentLoader, ShippingManagerFacade shippingManagerFacade, LanguageService languageService, ReferenceConverter referenceConverter, IAddressBookService addressBookService, CartItemViewModelFactory cartItemViewModelFactory, PreferredCultureAccessor preferredCulture, IRelationRepository relationRepository) { _contentLoader = contentLoader; _shippingManagerFacade = shippingManagerFacade; _languageService = languageService; _referenceConverter = referenceConverter; _addressBookService = addressBookService; _cartItemViewModelFactory = cartItemViewModelFactory; _relationRepository = relationRepository; _preferredCulture = preferredCulture(); }
public ShipmentViewModelFactory( IContentLoader contentLoader, ShippingManagerFacade shippingManagerFacade, LanguageService languageService, ReferenceConverter referenceConverter, IAddressBookService addressBookService, CartItemViewModelFactory cartItemViewModelFactory, PreferredCultureAccessor preferredCulture, IRelationRepository relationRepository) { _contentLoader = contentLoader; _shippingManagerFacade = shippingManagerFacade; _languageService = languageService; _referenceConverter = referenceConverter; _addressBookService = addressBookService; _cartItemViewModelFactory = cartItemViewModelFactory; _relationRepository = relationRepository; _preferredCulture = preferredCulture(); }
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 orderGroupFactoryMock = new Mock <IOrderGroupFactory>(); var urlResolverMock = new Mock <UrlResolver>(); var httpcontextMock = new Mock <HttpContextBase>(); var requestMock = new Mock <HttpRequestBase>(); var serviceCustomer = new Mock <ICustomerService>(); var organizationService = new Mock <IOrganizationService>(); var budgetService = new Mock <IBudgetService>(); var customerContext = new Mock <CustomerContextFacade>(); 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); PreferredCultureAccessor accessor = () => CultureInfo.InvariantCulture; var shipmentViewModelFactoryMock = new Mock <ShipmentViewModelFactory>(null, null, null, null, null, null, accessor, 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, orderGroupFactoryMock.Object, urlResolverMock.Object, (() => httpcontextMock.Object), shipmentViewModelFactoryMock.Object, serviceCustomer.Object, organizationService.Object, budgetService.Object, customerContext.Object); }