public void PriceTest03() { decimal? price = null; const decimal vatRate = 1.25M; var result = PriceCalulator.Price(price, vatRate); Assert.AreEqual(0, result); }
// TODO : Duplicate code protected static PriceModel MapPrice(Product product) { return(new PriceModel { Display = PriceCalulator.Price(product.Price, product.VatRate), Catalog = PriceCalulator.Price(product.PriceCatalog ?? product.Price, product.VatRate), Recommended = PriceCalulator.Price(product.PriceRecommended ?? product.Price, product.VatRate), VatRate = product.VatRate, PricelistId = product.PriceListId, IsFromPrice = false }); }
protected override PriceModel ResolveCore(BasketItem basketItem) { return(new PriceModel { Display = PriceCalulator.Price(basketItem.Price, basketItem.VatRate), Catalog = PriceCalulator.Price(basketItem.PriceCatalog ?? basketItem.Price, basketItem.VatRate), Recommended = PriceCalulator.Price(basketItem.PriceRecommended ?? basketItem.Price, basketItem.VatRate), VatRate = basketItem.VatRate, PricelistId = basketItem.PriceListId, IsFromPrice = false }); }
public PriceModel Resolve(BasketItem source, BasketItemModel destination, PriceModel destMember, ResolutionContext context) { return(new PriceModel { Display = PriceCalulator.Price(source.PriceDisplay, source.VatRate), Catalog = PriceCalulator.Price(source.PriceCatalog ?? source.PriceOriginal, source.VatRate), Recommended = PriceCalulator.Price(source.PriceRecommended ?? source.PriceOriginal, source.VatRate), Original = PriceCalulator.Price(source.PriceOriginal, source.VatRate), VatRate = source.VatRate, PricelistId = source.PriceListId, IsFromPrice = false }); }
public PriceModel Resolve(ProductItem source, TDest destination, PriceModel destMember, ResolutionContext context) { return(new PriceModel { Display = PriceCalulator.Price(source.Price, source.VatRate), Catalog = PriceCalulator.Price(source.PriceCatalog ?? source.Price, source.VatRate), Recommended = PriceCalulator.Price(source.PriceRecommended ?? source.Price, source.VatRate), Original = PriceCalulator.Price(source.Price, source.VatRate), VatRate = source.VatRate, PricelistId = source.PriceListId.GetValueOrDefault(0), IsFromPrice = false }); }
protected static PriceModel MapPrice(ProductPrice price) { if (price == null) { return(new PriceModel()); } return(new PriceModel { Display = PriceCalulator.Price(price.Value, price.VatRate), Catalog = PriceCalulator.Price(price.Catalog ?? price.Value, price.VatRate), Recommended = PriceCalulator.Price(price.Recommended ?? price.Value, price.VatRate), VatRate = price.VatRate, PricelistId = price.PriceListId, IsFromPrice = false }); }
protected static PriceModel MapPrice(ProductItem product) { if (product == null) { return(new PriceModel()); } return(new PriceModel { Display = PriceCalulator.Price(product.Price, product.VatRate), Catalog = PriceCalulator.Price(product.PriceCatalog ?? product.Price, product.VatRate), Recommended = PriceCalulator.Price(product.PriceRecommended ?? product.Price, product.VatRate), VatRate = product.VatRate, PricelistId = product.PriceListId.GetValueOrDefault(0), IsFromPrice = false }); }
public PriceModel Resolve(VariantItem source, VariantModel destination, PriceModel destMember, ResolutionContext context) { if (source.Price == null) { return(new PriceModel()); } var price = source.Price; return(new PriceModel { Display = PriceCalulator.Price(price.Value, price.VatRate), Catalog = PriceCalulator.Price(price.Catalog ?? price.Value, price.VatRate), Recommended = PriceCalulator.Price(price.Recommended ?? price.Value, price.VatRate), Original = PriceCalulator.Price(price.Value, price.VatRate), VatRate = price.VatRate, PricelistId = price.PriceListId, IsFromPrice = false }); }