Exemple #1
0
        public void ApplyTwoInOneAndOneEuroless_WhenThereAreTwoOrMuchVouchersAndThreeOrMoreTshirts()
        {
            this.shoppingBasketDtoMock.Setup(s => s.Products).Returns(TestsServices.CreateListWithThreeVouchersAndThreeTshirts());

            ShoppingBasketService sut = new ShoppingBasketService(shoppingBasketDtoMock.Object, mapperServiceMock.Object, efDbSetWrapper.Object, efDbContextSaveChanges.Object);

            //act
            var result = sut.GetTotalPrice() - sut.ApplyDiscountVoucher() - sut.ApplyDiscountTshirt();

            //assert
            Assert.AreEqual(74.5, result);
        }
Exemple #2
0
        public void NotApplyOneEuroLess_WhenThereAreLessOfThreeTshirts()
        {
            //arrange
            shoppingBasketDtoMock.Setup(s => s.Products).Returns(TestsServices.CreateListWithTwoTshirts());

            ShoppingBasketService sut = new ShoppingBasketService(shoppingBasketDtoMock.Object, mapperServiceMock.Object, efDbSetWrapper.Object, efDbContextSaveChanges.Object);

            //act
            var result = sut.GetTotalPrice() - sut.ApplyDiscountVoucher() - sut.ApplyDiscountTshirt();

            //assert
            Assert.AreEqual(57.5, result);
        }
        public void ReturnsTotalPriceOfTheProducts()
        {
            //arrange
            shoppingBasketDtoMock.Setup(s => s.Products).Returns(TestsServices.CreateListWithThreeVouchersAndThreeTshirts());

            ShoppingBasketService sut = new ShoppingBasketService(shoppingBasketDtoMock.Object, mapperServiceMock.Object, efDbSetWrapper.Object, efDbContextSaveChanges.Object);

            //act
            var result = sut.GetTotalPrice();

            //assert
            Assert.AreEqual(82.5, result);
        }
        public void ReturnsZero_WhenNotProducts()
        {
            //arrange
            shoppingBasketDtoMock.Setup(s => s.Products).Returns(
                new List <ProductDto>()
            {
            });

            ShoppingBasketService sut = new ShoppingBasketService(shoppingBasketDtoMock.Object, mapperServiceMock.Object, efDbSetWrapper.Object, efDbContextSaveChanges.Object);

            //act
            var result = sut.GetTotalPrice();

            //assert
            Assert.AreEqual(0, result);
        }