예제 #1
0
        public void vatConverstion()
        {
            //input
            decimal buyingAmount = 100;
            decimal vatRate      = 20;

            decimal CATTC = 200m;
            decimal CAHT  = 166.67m;

            decimal BenefitTTC = 200m;
            decimal BenefitHT  = 183.33m;

            if (Math.Round(PriceHelper.GetPriceHTFromPriceTTCOnRevenu(CATTC, vatRate), 2) != CAHT)
            {
                throw new Exception();
            }

            if (Math.Round(PriceHelper.GetPriceTTCFromPriceHTOnRevenu(CAHT, vatRate), 2) != CATTC)
            {
                throw new Exception();
            }


            if (Math.Round(PriceHelper.GetPriceHTFromPriceTTCOnProfit(BenefitTTC, buyingAmount, vatRate), 2) != BenefitHT)
            {
                throw new Exception();
            }

            if (Math.Round(PriceHelper.GetPriceTTCFromPriceHTOnProfit(BenefitHT, buyingAmount, vatRate), 2) != BenefitTTC)
            {
                throw new Exception();
            }
        }