Beispiel #1
0
 public BasketManager(IProductManager productManager, IBasketRepository basketRepository,
                      ISpecialOfferRepository specialOfferRepository)
 {
     _productManager         = productManager;
     _basketRepository       = basketRepository;
     _specialOfferRepository = specialOfferRepository;
 }
 public HealthyNutGuysSupervisor(
     UserManager <ApplicationUser> userManager,
     IApplicationUserRepository applicationUserRepository,
     IPromoCodeRepository promoCodeRepository,
     ISpecialOfferRepository specialOfferRepository,
     IProductRepository productRepository,
     ISaleItemRepository saleItemRepository,
     ICustomProductRepository customProductRepository,
     IMixCategoryRepository mixCategoryRepository,
     IIngredientRepository ingredientRepository,
     IUserSubscriptionRepository userSubscriptionRepository,
     IUserSubscriptionProductRepository userSubscriptionProductsRepository
     )
 {
     this._userManager = userManager;
     this._applicationUserRepository          = applicationUserRepository;
     this._promoCodeRepository                = promoCodeRepository;
     this._specialOfferRepository             = specialOfferRepository;
     this._productRepository                  = productRepository;
     this._saleItemRepository                 = saleItemRepository;
     this._customProductRepository            = customProductRepository;
     this._mixCategoryRepository              = mixCategoryRepository;
     this._ingredientRepository               = ingredientRepository;
     this._userSubscriptionRepository         = userSubscriptionRepository;
     this._userSubscriptionProductsRepository = userSubscriptionProductsRepository;
 }
Beispiel #3
0
 public CarService(IUserRepository repo1, IEnterpriseRepository ep, ICarRepository repo, ISpecialOfferRepository aaa, IUnitOfWork unitOfWork)
 {
     this.repo2      = ep;
     this.repo       = repo;
     this.unitOfWork = unitOfWork;
     this.repo3      = aaa;
     this.repo5      = repo1;
 }
Beispiel #4
0
 public SpecialOfferService(
     ILogger <ISpecialOfferRepository> logger,
     ISpecialOfferRepository specialOfferRepository,
     IApiSpecialOfferRequestModelValidator specialOfferModelValidator,
     IBOLSpecialOfferMapper bolspecialOfferMapper,
     IDALSpecialOfferMapper dalspecialOfferMapper)
     : base(logger,
            specialOfferRepository,
            specialOfferModelValidator,
            bolspecialOfferMapper,
            dalspecialOfferMapper)
 {
 }
Beispiel #5
0
 public AbstractSpecialOfferService(
     ILogger logger,
     ISpecialOfferRepository specialOfferRepository,
     IApiSpecialOfferRequestModelValidator specialOfferModelValidator,
     IBOLSpecialOfferMapper bolSpecialOfferMapper,
     IDALSpecialOfferMapper dalSpecialOfferMapper)
     : base()
 {
     this.SpecialOfferRepository     = specialOfferRepository;
     this.SpecialOfferModelValidator = specialOfferModelValidator;
     this.BolSpecialOfferMapper      = bolSpecialOfferMapper;
     this.DalSpecialOfferMapper      = dalSpecialOfferMapper;
     this.logger = logger;
 }
Beispiel #6
0
        public void PriceCalculationLogic_MultipleQuantity_NoOffers()
        {
            //Arrange
            ISpecialOfferRepository specialOfferRepository = Substitute.For <ISpecialOfferRepository>();

            CheckoutItem checkoutItem = new CheckoutItem {
                Price = 0.5M, Quantity = 4
            };

            PriceCalculationLogic priceCalculationLogic = new PriceCalculationLogic(specialOfferRepository);

            //Act
            var price = priceCalculationLogic.GetPrice(checkoutItem);

            //Assert
            Assert.AreEqual(2m, price);
        }
Beispiel #7
0
        internal static int GetTotal(IDictionary <string, int> scannedSkus, ISpecialOfferRepository offers, IPriceListRepository priceList)
        {
            var total = 0;

            foreach (var sku in scannedSkus.Keys)
            {
                var numberOfItemsScannedForSku = scannedSkus[sku];
                var specialOffer = offers.GetOfferFor(sku);
                if (specialOffer.Found)
                {
                    var offer = specialOffer.Offer;
                    var numberOfTimeSpecialOfferScanned = numberOfItemsScannedForSku / offer.Quantity;
                    total += offer.Price * numberOfTimeSpecialOfferScanned;
                    numberOfItemsScannedForSku -= offer.Quantity * numberOfTimeSpecialOfferScanned;
                }

                total += priceList.GetPriceFor(sku) * numberOfItemsScannedForSku;
            }

            return(total);
        }
Beispiel #8
0
        public void PriceCalculationLogic_MultipleQuantity_WithOffer_MultiQualifying()
        {
            //Arrange
            ISpecialOfferRepository specialOfferRepository = Substitute.For <ISpecialOfferRepository>();

            specialOfferRepository.GetBySku("A99").Returns(new SpecialOffer {
                Quantity = 3, OfferPrice = 1.3M
            });

            CheckoutItem checkoutItem = new CheckoutItem {
                Sku = "A99", Price = 0.5M, Quantity = 6
            };

            PriceCalculationLogic priceCalculationLogic = new PriceCalculationLogic(specialOfferRepository);

            //Act
            var price = priceCalculationLogic.GetPrice(checkoutItem);

            //Assert
            Assert.AreEqual(2.6m, price);
            specialOfferRepository.Received(1).GetBySku("A99");
        }
 public ApiSpecialOfferRequestModelValidator(ISpecialOfferRepository specialOfferRepository)
     : base(specialOfferRepository)
 {
 }
Beispiel #10
0
 public AbstractApiSpecialOfferRequestModelValidator(ISpecialOfferRepository specialOfferRepository)
 {
     this.specialOfferRepository = specialOfferRepository;
 }
Beispiel #11
0
 public SpecialOfferService(ISpecialOfferRepository repo, IUnitOfWork unitOfWork)
 {
     this.repo       = repo;
     this.unitOfWork = unitOfWork;
 }
Beispiel #12
0
 public StayCalculator(IHotelRoomRateRepository hotelRoomRateRepository, ISpecialOfferRepository specialOfferRepository)
 {
     _hotelRoomRateRepository = hotelRoomRateRepository;
     _specialOfferRepository  = specialOfferRepository;
 }
Beispiel #13
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="specialOfferRepository"></param>
 public PriceCalculationLogic(ISpecialOfferRepository specialOfferRepository)
 {
     this.specialOfferRepository = specialOfferRepository ?? throw new ArgumentNullException(nameof(specialOfferRepository));
 }
 public SpecialOfferService(ISpecialOfferRepository specialOfferRepository)
 {
     _specialOfferRepository = specialOfferRepository;
 }
Beispiel #15
0
 public SpecialOfferCalculator(ISpecialOfferRepository specialOfferRepository, ILogger <BasketProvider> logger)
 {
     _specialOfferRepository = specialOfferRepository;
     _logger = logger;
 }
Beispiel #16
0
 public Cart()
 {
     _priceList = new PriceListRepository();
     _offers    = new SpecialOfferRepository();
 }