public async Task CartItemUpdatedEventRaised_WhenItemRemoved()
        {
            var shoppingCartItemUpdatedRaised = false;
            var shoppingCartService           = new MockShoppingCartService()
            {
                RemoveShoppingCartItemDelegate = (s, s1) =>
                {
                    Assert.AreEqual("TestShoppingCartItemId", s1);
                    return(Task.FromResult(string.Empty));
                }
            };
            var shoppingCartItemUpdatedEvent = new ShoppingCartItemUpdatedEvent();

            shoppingCartItemUpdatedEvent.Subscribe((a) => shoppingCartItemUpdatedRaised = true);

            var eventAggregator = new MockEventAggregator()
            {
                GetEventDelegate = (a) => shoppingCartItemUpdatedEvent
            };

            var target = new ShoppingCartRepository(shoppingCartService, new MockAccountService(), eventAggregator, new MockSessionStateService());
            await target.RemoveShoppingCartItemAsync("TestShoppingCartItemId");

            Assert.IsTrue(shoppingCartItemUpdatedRaised);
        }
        public void CartItemUpdatedEventRaised_WhenProductRemoved()
        {
            var shoppingCartItemUpdatedRaised = false;
            var shoppingCartService = new MockShoppingCartService();
            shoppingCartService.RemoveProductFromShoppingCartAsyncDelegate =
                (s, s1) => Task.FromResult(string.Empty);
            var shoppingCartItemUpdatedEvent = new ShoppingCartItemUpdatedEvent();
            shoppingCartItemUpdatedEvent.Subscribe((_) =>
            {
                shoppingCartItemUpdatedRaised = true;
            });
            var eventAggregator = new MockEventAggregator();
            eventAggregator.GetEventDelegate = type => shoppingCartItemUpdatedEvent;
            var target = new ShoppingCartRepository(shoppingCartService, new MockAccountService(), eventAggregator, new MockProductCatalogRepository(), new MockSuspensionManagerState());

            target.RemoveProductFromShoppingCartAsync("TestProductId");

            Assert.IsTrue(shoppingCartItemUpdatedRaised);
        }
        public async void CartItemUpdatedEventRaised_WhenProductAdded()
        {
            var shoppingCartItemUpdatedRaised = false;
            var shoppingCartService = new MockShoppingCartService();
            shoppingCartService.AddProductToShoppingCartAsyncDelegate =
                (s, s1) => Task.FromResult(string.Empty);
            var shoppingCartItemUpdatedEvent = new ShoppingCartItemUpdatedEvent();
            shoppingCartItemUpdatedEvent.Subscribe((_) =>
                                                   {
                                                       shoppingCartItemUpdatedRaised = true;
                                                   });
            var eventAggregator = new MockEventAggregator();
            eventAggregator.GetEventDelegate = type => shoppingCartItemUpdatedEvent;
            var target = new ShoppingCartRepository(shoppingCartService, new MockAccountService(), eventAggregator, new MockSessionStateService());

            await target.AddProductToShoppingCartAsync("TestProductId");

            Assert.IsTrue(shoppingCartItemUpdatedRaised);
        }
        public async void CartItemUpdatedEventRaised_WhenProductRemoved()
        {
            var shoppingCartItemUpdatedRaised = false;
            var shoppingCartService           = new MockShoppingCartService();

            shoppingCartService.RemoveProductFromShoppingCartAsyncDelegate =
                (s, s1) => Task.FromResult(string.Empty);
            var shoppingCartItemUpdatedEvent = new ShoppingCartItemUpdatedEvent();

            shoppingCartItemUpdatedEvent.Subscribe((_) =>
            {
                shoppingCartItemUpdatedRaised = true;
            });
            var eventAggregator = new MockEventAggregator();

            eventAggregator.GetEventDelegate = type => shoppingCartItemUpdatedEvent;
            var target = new ShoppingCartRepository(shoppingCartService, new MockAccountService(), eventAggregator, new MockSessionStateService());

            await target.RemoveProductFromShoppingCartAsync("TestProductId");

            Assert.IsTrue(shoppingCartItemUpdatedRaised);
        }
        public async Task CartItemUpdatedEventRaised_WhenItemRemoved()
        {
            var shoppingCartItemUpdatedRaised = false;
            var shoppingCartService = new MockShoppingCartService()
                {
                    RemoveShoppingCartItemDelegate = (s, s1) =>
                        {
                            Assert.AreEqual("TestShoppingCartItemId", s1);
                            return Task.FromResult(string.Empty);
                        }
                };
            var shoppingCartItemUpdatedEvent = new ShoppingCartItemUpdatedEvent();
            shoppingCartItemUpdatedEvent.Subscribe((a) => shoppingCartItemUpdatedRaised = true);

            var eventAggregator = new MockEventAggregator()
                {
                    GetEventDelegate = (a) => shoppingCartItemUpdatedEvent
                };

            var target = new ShoppingCartRepository(shoppingCartService, new MockAccountService(), eventAggregator, new MockProductCatalogRepository(), new MockSuspensionManagerState());
            await target.RemoveShoppingCartItemAsync("TestShoppingCartItemId");

            Assert.IsTrue(shoppingCartItemUpdatedRaised);
        }