public void Setup() { IOC.UnitTest(); _product = new Product {UrlName = "prod", Categories = new API.ICategory[] {new StubCategory()}}; IOC.CategoryCatalogUrlService.SetupNewMock().Setup(m => m.GetCanonicalUrl(It.IsAny<ICategory>())).Returns("[catname]"); _productUrlService = IOC.ProductUrlService.Actual().Resolve(); }
public void Setup() { IOC.UnitTest(); _repository = (UmbracoProductRepository) IOC.ProductRepository.Actual().Resolve(); _product = new Product {ParentId = 0}; _propertyProvider = new TestPropertyProvider(); _localization = new StubLocalization {CurrencyCode = "EUR", StoreAlias = "EN", Currency = new StubCurrency {Ratio = (decimal) 1.1}}; }
public void Orderable_StockTrueVariantFalseBackorderFalseStock100_ShouldReturnTrue() { IOC.UnitTest(); IOC.StockService.SetupNewMock().Setup(m => m.GetStockForUwebshopEntityWithId(It.IsAny<int>(), null)).Returns(100); var product = new Product { UseVariantStock = false, StockStatus = true, BackorderStatus = false, VariantGroups = Enumerable.Empty<IProductVariantGroup>(), ProductVariantGroupsFactory = () => new List<IProductVariantGroup>(), }; Assert.IsTrue(product.Orderable); }
public void Setup() { IOC.IntegrationTest(); _product = new Product {OriginalPriceInCents = 1000, Id = 12234, Ranges = new List<Range>(), Vat = 21m}; _variant = new ProductVariant {OriginalPriceInCents = 100}; _product.VariantGroups = new List<IProductVariantGroup>{ new ProductVariantGroup("",new List<ProductVariant> {_variant},1)}; _variant.Product = _product; }
public void OrderableTestCases_NoVariants(bool stockStatus, bool backOrderStatus, int stock, bool expected) { IOC.UnitTest(); IOC.StockService.SetupNewMock().Setup(m => m.GetStockForUwebshopEntityWithId(It.IsAny<int>(), null)).Returns(stock); IOC.ProductService.Actual(); var product = new Product { UseVariantStock = false, StockStatus = stockStatus, BackorderStatus = backOrderStatus, VariantGroups = Enumerable.Empty<IProductVariantGroup>(), ProductVariantGroupsFactory = () => new List<IProductVariantGroup>(), }; Assert.AreEqual(expected, product.Orderable); }
public void Setup() { IOC.UnitTest(); _repository = (UmbracoProductRepository) IOC.ProductRepository.Actual().Resolve(); _product = new Product {ParentId = 0}; _propertyProvider = new TestPropertyProvider(); //_localization = new StubLocalization {StoreAlias = StoreAlias}; var store = StoreHelper.GetCurrentStore(); StoreAlias = store.Alias; _localization = Localization.CreateLocalization(store); // todo: not neccessary? }
public void Setup() { IOC.IntegrationTest(); _product = new Product(); _product.Localization = StoreHelper.CurrentLocalization; _product.Id = 1; _product.Ranges = new List<Range>(); _product.PricesIncludingVat = false; _product.ProductDiscount = null; }
/// <summary> /// Initializes a new instance of the <see cref="ProductInfo"/> class. /// </summary> /// <param name="product">The product.</param> /// <param name="order">The order.</param> /// <param name="itemCount">The item count.</param> public ProductInfo(Product product, OrderInfo order, int itemCount) : this() { if (product == null) { return; //throw new ArgumentNullException("product null"); } Order = order; _product = product; Id = product.Id; ItemCount = itemCount; Title = product.Title; SKU = product.SKU; Tags = product.Tags; Weight = product.Weight; Length = product.Length; Width = product.Width; Height = product.Height; Vat = product.Vat; ChangedOn = DateTime.Now; Ranges = product.Ranges.ToList(); // = localized OriginalPriceInCents = product.Price.BeforeDiscount.ValueInCents(); var discount = IO.Container.Resolve<IProductDiscountService>().GetDiscountByProductId(product.Id, order.Localization, order); if (discount != null) { DiscountId = discount.Id; } IO.Container.Resolve<IOrderUpdatingService>().UpdateProductInfoDiscountInformation(this); DocTypeAlias = product.NodeTypeAlias; }
public void Setup() { IOC.IntegrationTest(); IOC.UrlService.Mock(out _urlService); _product = TestProductService.Product1; }
public void Setup() { IOC.IntegrationTest(); // at some point we will need to specify here that we want to use the 'storeUrl localization' module and 'catalog recursive categories url' (oid) module _product = new Product {UrlName = "prod", Categories = new ICategory[] {new StubCategory {UrlName = "cat2", ParentCategory = new StubCategory {UrlName = "cat1"}}}}; }