示例#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);
        }
示例#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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }