public PriceAccountant(IDiscountCouponService discountCouponService, IUserService userService, ICartItemService cartItemService, IProductService productService, ITaxAccountant taxAccountant, TaxSettings taxSettings, ICartService cartService, IProductVariantService productVariantService, IRoundingService roundingService, IOrderService orderService) { _discountCouponService = discountCouponService; _userService = userService; _cartItemService = cartItemService; _productService = productService; _taxAccountant = taxAccountant; _taxSettings = taxSettings; _cartService = cartService; _productVariantService = productVariantService; _roundingService = roundingService; _orderService = orderService; }
public DiscountsController(IDiscountCouponService discountCouponService, IModelMapper modelMapper, IDataSerializer dataSerializer, IProductService productService, IUserService userService, IRoleService roleService, ICategoryService categoryService, IVendorService vendorService, IManufacturerService manufacturerService, ICategoryAccountant categoryAccountant, IRestrictionValueService restrictionValueService) { _discountCouponService = discountCouponService; _modelMapper = modelMapper; _dataSerializer = dataSerializer; _productService = productService; _userService = userService; _roleService = roleService; _categoryService = categoryService; _vendorService = vendorService; _manufacturerService = manufacturerService; _categoryAccountant = categoryAccountant; _restrictionValueService = restrictionValueService; }
public void Setup() { _discountCouponService = Resolve <IDiscountCouponService>(); }
protected void Setup() { _cartService = Resolve <ICartService>(); _userService = Resolve <IUserService>(); _productService = Resolve <IProductService>(); _priceAccountant = Resolve <IPriceAccountant>(); _roleService = Resolve <IRoleService>(); _discountCouponService = Resolve <IDiscountCouponService>(); _categoryService = Resolve <ICategoryService>(); _vendorService = Resolve <IVendorService>(); _manufacturerService = Resolve <IManufacturerService>(); _settingService = Resolve <ISettingService>(); _taxSettings = Resolve <TaxSettings>(); _registeredUser = new User() { Email = "*****@*****.**", CreatedOn = DateTime.UtcNow, UpdatedOn = DateTime.UtcNow, }; _userService.Insert(_registeredUser); _registeredRole = _roleService.FirstOrDefault(x => x.SystemName == SystemRoleNames.Registered); _roleService.SetUserRoles(_registeredUser.Id, new [] { _registeredRole.Id }); //registered user _registeredUser = _userService.Get(_registeredUser.Id); _visitor = new User() { Email = "*****@*****.**", CreatedOn = DateTime.UtcNow, UpdatedOn = DateTime.UtcNow, }; _userService.Insert(_visitor); _visitorRole = _roleService.FirstOrDefault(x => x.SystemName == SystemRoleNames.Visitor); _roleService.SetUserRoles(_visitor.Id, new[] { _visitorRole.Id }); //visitor user _visitor = _userService.Get(_visitor.Id); _manufacturer = new Manufacturer() { Name = "Test Manufacturer" }; _manufacturerService.Insert(_manufacturer); _vendor = new Vendor() { Name = "Test Vendor", Address = "Test Address", City = "Test City" }; _vendorService.Insert(_vendor); var products = EvenCart.Tests.Data.Products.GetList(); _product1 = products[0]; _product1.ManufacturerId = _manufacturer.Id; _productService.Insert(_product1); _product2 = products[1]; _productService.Insert(_product2); _vendorService.AddVendorProduct(_vendor.Id, _product2.Id); _category = new Category() { Name = "Test Category" }; _categoryService.Insert(_category); _productService.LinkCategoryWithProduct(_category.Id, _product1.Id, 0); var discounts = new[] { new DiscountCoupon() { Name = "Test Coupon One", CalculationType = CalculationType.FixedAmount, HasCouponCode = false, DiscountValue = 10, Enabled = true, StartDate = DateTime.UtcNow, EndDate = DateTime.UtcNow.AddDays(5), NumberOfTimesPerUser = 1, TotalNumberOfTimes = 5, RestrictionType = RestrictionType.OrderTotal }, new DiscountCoupon() { Name = "Test Coupon Two", CalculationType = CalculationType.Percentage, CouponCode = "VALIDCOUPON", HasCouponCode = true, DiscountValue = 5, Enabled = true, StartDate = DateTime.UtcNow, EndDate = DateTime.UtcNow.AddDays(5), NumberOfTimesPerUser = 1, TotalNumberOfTimes = 5 }, new DiscountCoupon() { Name = "Expired Coupon", CalculationType = CalculationType.Percentage, HasCouponCode = true, CouponCode = "EXPIREDCOUPON", DiscountValue = 5, Enabled = true, StartDate = DateTime.UtcNow.AddDays(-5), EndDate = DateTime.UtcNow.AddDays(-1), NumberOfTimesPerUser = 1, TotalNumberOfTimes = 5, MaximumDiscountAmount = 10 }, }; //save some discounts _discountCouponService.Insert(discounts); _autoCoupon = discounts[0]; _validCoupon = discounts[1]; }