Ejemplo n.º 1
0
        public void Convert()
        {
            var notifier = new ProgressCancelNotifier();

            decimal vatRate = 20;

            //TVA sur CA
            decimal amountTTC = 10;
            decimal amountHT  = 8.33m;

            Assert.AreEqual(PriceHelper.ConvertVATRateOnRevenu(amountTTC, vatRate, 0), amountHT);
            Assert.AreEqual(PriceHelper.ConvertVATRateOnRevenu(amountHT, 0, vatRate), amountTTC);

            //TVA sur marge
            decimal sellingPriceTTC = 20;
            decimal sellingPriceHT  = 18;
            decimal buyingPriceHT   = 8;

            Assert.AreEqual(PriceHelper.ConvertVATRateOnProfit(sellingPriceTTC, buyingPriceHT, vatRate, 0), sellingPriceHT);
            Assert.AreEqual(PriceHelper.ConvertVATRateOnProfit(sellingPriceHT, buyingPriceHT, 0, vatRate), sellingPriceTTC);
            Assert.AreEqual(PriceHelper.ConvertVATRateOnProfit(sellingPriceTTC, buyingPriceHT, vatRate, vatRate), sellingPriceTTC);
        }