Пример #1
0
        public void GetAmount_WhenItemsArePassed_ShouldApplyAllRateManagers()
        {
            //Arrange
            var promotionManager    = new Mock <IPromotionManager>();
            var cartItemsMockedData = new CartItems();
            var items = cartItemsMockedData.GetAll();
            List <List <CartItem> > capturedItems = new List <List <CartItem> >();

            promotionManager.Setup(m => m.GetPromotionAmount(Capture.In(capturedItems))).Returns(100);
            var sut = GenerateSUT(promotionManager);

            //Act
            var amount = sut.GetAmount(items);

            //Assert
            Assert.Single(capturedItems);
            var expectedAmount = 100 + capturedItems[0].Sum(m => m.GetAmount());

            Assert.Equal(expectedAmount, amount);
        }