Exemple #1
0
        public void ShouldMergeCartsOnLogIn(bool persistent)
        {
            // Arrange
            var contactModel = new FakeContact();
            var contact      = new ContactContext(contactModel);
            var tracker      = Substitute.For <ITracker>();
            var testCart     = new Sitecore.Commerce.Entities.Carts.Cart();

            tracker.Contact.Returns(contact);

            var cartService = Substitute.For <ICartService>();

            cartService.GetCart().Returns(testCart);

            var customerProvider = Substitute.For <CustomerServiceProvider>();
            var accountService   = new AccountService(cartService, customerProvider);

            // Act
            using (new Switcher <ITracker, TrackerSwitcher>(tracker))
            {
                accountService.Login("user", "password", persistent);
            }

            // Assert
            cartService.Received().MergeCarts(testCart);
        }
Exemple #2
0
 public override void Initialize(Sitecore.Commerce.Entities.Carts.Cart cart, IVisitorContext visitorContext)
 {
     this.CurrencyCode = this.StorefrontContext.CurrentStorefront.SelectedCurrency;
     base.Initialize(cart, visitorContext);
 }