public void ShouldReturnEpfAsDeductionIfNoOtherInvestmentIsMade()
 {
     const int epfContribution = 100;
     var salary = new AnnualSalary {Epf = epfContribution};
     TaxStatement ts = new TaxStatement(salary, null) { Chapter6Investments = null };
     Assert.AreEqual(epfContribution, ts.GetChapter6Deductions(), 0.01);
 }
        public void MustCalculateNetPayableTaxWithAnnualSalaryOtherIncomesAndChapter6Investments()
        {
            var taxPayer = new User(50000, true, Gender.Female);

            TaxSlabs ts = TaxSlabs.GetInstance();
            AnnualSalary asal = new AnnualSalary
            {
                Basic = 810000.50,
                Hra = 1000,
                ProfessionalTax = 100,
                SpecialAllowance = 10
            };

            OtherIncomes otherIncomes = new OtherIncomes();
            otherIncomes.Add(new OtherIncomeItem("Income from Interest", 4000.0));
            otherIncomes.Add(new OtherIncomeItem("Income from House Rent", 8000.0));

            Chapter6Investments investments = new Chapter6Investments();
            investments.Add(new LifeInsurance(50000));
            investments.Add(new Elss(60000));

            TaxStatement stmt = new TaxStatement(asal, taxPayer);
            stmt.HousingLoanInterest = new HousingLoanInterest(10000);
            stmt.OtherIncomes = otherIncomes;
            stmt.Chapter6Investments = investments;

            Assert.AreEqual(120473,
                stmt.CalculateNetPayableTax(), 2);
        }
Beispiel #3
0
        public void ShouldSaveAndLoadTaxStatement()
        {
            IRepository repository = new Repository();
            var password = new Password { PasswordString = "abc" };
            var email = new EmailAddress("*****@*****.**");
            var taxPayer= new User(email, password);

            taxPayer.FromMetro = true;
            taxPayer.RentPaid = 8000.00;

            AnnualSalary salary = new AnnualSalary() { Basic = 10000, Epf = 2000, Hra = 6000, Id = "salary", ProfessionalTax = 200, SpecialAllowance = 5000, TaxDedeuctedAtSource = 5000};
            TaxStatement taxStatement = new TaxStatement(salary, taxPayer);

            DonationsUnder80G donationsUnder80G = new DonationsUnder80G();
            var halfExemptDonation = new HalfExemptDonation(20000);
            donationsUnder80G.AddDonation(halfExemptDonation);
            var fullyExemptDonation = new FullyExemptDonation(10000);
            donationsUnder80G.AddDonation(fullyExemptDonation);
            taxStatement.DonationsUnder80G = donationsUnder80G;
            repository.Save(taxStatement);

            List<TaxStatement> taxStatements = repository.LoadAll<TaxStatement>();
            var loadedTaxStatement = taxStatements.FirstOrDefault(stmt => stmt.Id == taxStatement.Id);
            Assert.IsNotNull(loadedTaxStatement);
            Assert.IsNotNull(loadedTaxStatement.TaxPayer);
            Assert.IsTrue(taxStatement.GetDonationsUnder80G().Contains(halfExemptDonation));
            Assert.IsTrue(taxStatement.GetDonationsUnder80G().Contains(fullyExemptDonation));
        }
 public void ShouldReturnLifeInsuranceInvestmentAsDeductionIfNoOtherInvestmentIsMadeAndEpfIsZero()
 {
     var investments = new Chapter6Investments();
     investments.Add(new LifeInsurance(30000));
     var salary = new AnnualSalary {Epf = 0};
     TaxStatement ts = new TaxStatement(salary, null) { Chapter6Investments = investments };
     Assert.AreEqual(30000.0, ts.GetChapter6Deductions(), 0.01);
 }
        public void ShouldReturnDeductionCapAsDeductionWhenOnlyHousingLoanPrincipalAsInvestementWithEpfAsZeroAndExceedsTheCap()
        {
            var investments = new Chapter6Investments();
            investments.Add(new HousingLoanPrincipal(100001));
            var salary = new AnnualSalary { Epf = 0 };

            TaxStatement ts = new TaxStatement(salary, null) { Chapter6Investments = investments };

            Assert.AreEqual(Chapter6Investments.Cap, ts.GetChapter6Deductions(), 0.01);
        }
        public void ShouldReturnCapValueAsDeductionIfLifeInsuranceAndElssInvestmentsExceedsTheCapAndOtherInvestmentAreZero()
        {
            var investments = new Chapter6Investments();
            investments.Add(new LifeInsurance(50000));
            investments.Add(new Elss(60000));

            var salary = new AnnualSalary {Epf = 0};
            TaxStatement ts = new TaxStatement(salary, null) { Chapter6Investments = investments };
            Assert.AreEqual(Chapter6Investments.Cap, ts.GetChapter6Deductions(), 0.01);
        }
        public void ShouldReturnDeductionCapAsDeductionWhenTotalOfAllInvestmetIsAboveDeductionCap()
        {
            var investments = new Chapter6Investments();
            investments.Add(new LifeInsurance(50000));
            investments.Add(new Elss(30000));
            investments.Add(new PublicProvidentFund(10000));

            var salary = new AnnualSalary {Epf = 500000};
            TaxStatement ts = new TaxStatement(salary, null) { Chapter6Investments = investments };
            Assert.AreEqual(Chapter6Investments.Cap, ts.GetChapter6Deductions(), 0.01);
        }
Beispiel #8
0
 public void ShouldBeAbleToGetHra()
 {
     var annualSalary = new AnnualSalary
                            {
                                Basic = 10000.50,
                                Hra = 1000,
                                ProfessionalTax = 100,
                                SpecialAllowance = 10
                            };
     Assert.AreEqual(1000, annualSalary.Hra);
 }
Beispiel #9
0
 public void ShouldCalculateHraExemption()
 {
     var taxPayer = new User(50000, true, Gender.Male);
     var annualSalary = new AnnualSalary
                            {
                                Basic = 100000,
                                Hra = 40000,
                                ProfessionalTax = 100,
                                SpecialAllowance = 10
                            };
     Assert.AreEqual(40000, annualSalary.CalculateHraExemption(taxPayer.FromMetro, taxPayer.RentPaid));
 }
Beispiel #10
0
 public void MustCalculateNetPayableTaxWithAnnualSalaryAndDeductions()
 {
     var taxPayer = new User(0, true, Gender.Female);
     TaxSlabs ts = TaxSlabs.GetInstance();
     AnnualSalary asal = new AnnualSalary
                            {
                                Basic = 600000,
                                Hra = 100000
                            };
     TaxStatement stmt = new TaxStatement(asal,taxPayer);
     DonationsUnder80G donationsUnder80G = new DonationsUnder80G();
     donationsUnder80G.AddDonation(new FullyExemptDonation(1000));
     stmt.DonationsUnder80G = donationsUnder80G;
     Assert.AreEqual(116700.0, stmt.CalculateNetPayableTax(),0.01);
 }
Beispiel #11
0
        public void ComputeTaxShouldDeductTDSValueFromTheNetTaxPayableValue()
        {
            var taxPayer = new User(50000, true, Gender.Female);
            TaxSlabs ts = TaxSlabs.GetInstance();
            AnnualSalary asal = new AnnualSalary
            {
                Basic = 200000.50,
                Hra = 1000,
                ProfessionalTax = 100,
                SpecialAllowance = 10,
                TaxDedeuctedAtSource = 1000
            };
            TaxStatement stmt = new TaxStatement(asal, taxPayer);

            Assert.AreEqual(891.04,stmt.CalculateNetPayableTax(), 2);
        }
Beispiel #12
0
        private double CalculateGrossIncome(User taxPayer)
        {
            double retAmt = AnnualSalary.GetTaxableSalary();

            retAmt -= GetHousingLoanInterestAmount();

            if (OtherIncomes != null)
            {
                retAmt += OtherIncomes.CalculateTotalAmount();
            }


            retAmt -= (AnnualSalary.CalculateHraExemption(taxPayer.FromMetro, taxPayer.RentPaid) +
                       AnnualSalary.ProfessionalTax);

            retAmt -= DonationsUnder80G.GetDeduction();

            return(retAmt);
        }
Beispiel #13
0
        public void MustCalculateNetPayableTaxWithAnnualSalaryAndOtherIncomes()
        {
            var taxPayer = new User(50000, true, Gender.Female);
            TaxSlabs ts = TaxSlabs.GetInstance();
            AnnualSalary asal = new AnnualSalary
                                   {
                                       Basic = 200000.50,
                                       Hra = 1000,
                                       ProfessionalTax = 100,
                                       SpecialAllowance = 10
                                   };
            TaxStatement stmt = new TaxStatement(asal,taxPayer);

            OtherIncomes otherIncomes = new OtherIncomes();
            otherIncomes.Add(new OtherIncomeItem("Income from Interest", 4000.0));
            otherIncomes.Add(new OtherIncomeItem("Income from House Rent", 8000.0));
            stmt.OtherIncomes = otherIncomes;

            double totalIncome = asal.GetTaxableSalary() + otherIncomes.CalculateTotalAmount();

            Assert.AreEqual(3091,
                stmt.CalculateNetPayableTax(),2);
        }
Beispiel #14
0
        public void ShouldSaveAndLoadTaxStatementWithHousingLoanInterest()
        {
            IRepository repository = new Repository();

            AnnualSalary salary = new AnnualSalary() { Basic = 10000, Epf = 2000, Hra = 6000, Id = "salary", ProfessionalTax = 200, SpecialAllowance = 5000, TaxDedeuctedAtSource = 5000 };
            TaxStatement taxStatement = new TaxStatement(salary, null);

            DonationsUnder80G donationsUnder80G = new DonationsUnder80G();
            donationsUnder80G.AddDonation(new HalfExemptDonation(20000));
            donationsUnder80G.AddDonation(new FullyExemptDonation(10000));

            OtherIncomes ois = new OtherIncomes();
            IList<OtherIncomeItem> items = new List<OtherIncomeItem>() { new OtherIncomeItem("Income from House Rent", 16000.0), new OtherIncomeItem("Income from Bank Account Interest", 6000.0) };
            foreach (OtherIncomeItem otherIncomeItem in items)
            {
                ois.Add(otherIncomeItem);
            }

            taxStatement.OtherIncomes = ois;

            taxStatement.DonationsUnder80G = donationsUnder80G;
            taxStatement.HousingLoanInterest = new HousingLoanInterest(10000);
            repository.Save(taxStatement);

            List<TaxStatement> taxStatements = repository.LoadAll<TaxStatement>();
            var loadedTaxStatement = taxStatements.FirstOrDefault(stmt => stmt.Id == taxStatement.Id);
            Assert.IsNotNull(loadedTaxStatement);
            Assert.IsNotNull(loadedTaxStatement.OtherIncomes);
            Assert.IsTrue(loadedTaxStatement.OtherIncomes.HasItems);
            Assert.AreEqual(2, loadedTaxStatement.OtherIncomes.Count);

            foreach (OtherIncomeItem otherIncomeItem in loadedTaxStatement.OtherIncomes.GetItems())
            {
                Assert.IsTrue(items.Contains(otherIncomeItem));
            }
            Assert.AreEqual(10000, loadedTaxStatement.HousingLoanInterest.Amount);
        }
Beispiel #15
0
        public void MustCalculateNetPayableTaxWithAnnualSalaryOtherIncomesAndChapter6Investments()
        {
            var taxPayer = new User(50000, true, Gender.Female);
            TaxSlabs ts = TaxSlabs.GetInstance();
            AnnualSalary asal = new AnnualSalary
                                   {
                                       Basic = 800000.50,
                                       Hra = 1000,
                                       ProfessionalTax = 100,
                                       SpecialAllowance = 10
                                   };

            OtherIncomes otherIncomes = new OtherIncomes();
            otherIncomes.Add(new OtherIncomeItem("Income from Interest", 4000.0));
            otherIncomes.Add(new OtherIncomeItem("Income from House Rent", 8000.0));

            Chapter6Investments investments = new Chapter6Investments();
            investments.Add(new LifeInsurance(50000));
            investments.Add(new Elss(60000));

            TaxStatement stmt = new TaxStatement(asal,taxPayer);
            stmt.OtherIncomes = otherIncomes;
            stmt.Chapter6Investments = investments;

            double totalIncome = ((asal.GetTaxableSalary() + otherIncomes.CalculateTotalAmount())
                                  -
                                  (asal.CalculateHraExemption(taxPayer.FromMetro, taxPayer.RentPaid)));

            double totalInvestments = (asal.Epf + investments.GetTotal());

            totalIncome -= totalInvestments <= Chapter6Investments.Cap
                 ? totalInvestments
                 : Chapter6Investments.Cap;

            Assert.AreEqual(120473,
                stmt.CalculateNetPayableTax(),2);
        }
Beispiel #16
0
 public void MustHaveAnAnnualSalary()
 {
     AnnualSalary asal  = new AnnualSalary();
     TaxStatement stmt = new TaxStatement(asal,null);
     Assert.AreSame(asal, stmt.AnnualSalary);
 }
Beispiel #17
0
 public TaxStatement(AnnualSalary annualSalary, User taxPayer)
 {
     AnnualSalary = annualSalary;
     TaxPayer = taxPayer;
 }
Beispiel #18
0
        public void ShouldReturnTotalDeductionsAsDeductionWhenOnlyHousingLoanPrincipalAsInvestementWithEpfAndUnderTheCap()
        {
            var investments = new Chapter6Investments();
            investments.Add(new HousingLoanPrincipal(60001));
            var salary = new AnnualSalary { Epf = 10000 };

            TaxStatement ts = new TaxStatement(salary, null) { Chapter6Investments = investments };

            Assert.AreEqual(70001, ts.GetChapter6Deductions(), 0.01);
        }
Beispiel #19
0
 public void ShouldReturnRemtPaidAdjustedToBasicAsHraExemptionWhenItIsMinimumOfAllTaxComponents()
 {
     var taxPayer = new User(30000, true, Gender.Male);
     var annualSalary = new AnnualSalary
                            {
                                Basic = 100000,
                                Hra = 60000,
                                ProfessionalTax = 100,
                                SpecialAllowance = 10
                            };
     Assert.AreEqual(20000, annualSalary.CalculateHraExemption(taxPayer.FromMetro, taxPayer.RentPaid));
 }
Beispiel #20
0
        public void ShouldReturnTotalInvestmentCapAsDeductionIfLicElssAndPpfInvestmentsExceedsTheCapAndEpfIsZero()
        {
            var investments = new Chapter6Investments();
            investments.Add(new LifeInsurance(50000));
            investments.Add(new Elss(30000));
            investments.Add(new PublicProvidentFund(20000.01));

            var salary = new AnnualSalary {Epf = 0 };
            TaxStatement ts = new TaxStatement(salary, null) { Chapter6Investments = investments };
            Assert.AreEqual(Chapter6Investments.Cap, ts.GetChapter6Deductions(), 0.01);
        }
Beispiel #21
0
        public void ShouldReturnFortyPercentageOfBasicAsHraExemptionWhenItIsMinimumOfAllTaxComponentsAndPayerIsFromMetro()
        {
            var taxPayer = new User(65000, false, Gender.Male);
            var annualSalary = new AnnualSalary
                                   {
                                       Basic = 100000,
                                       Hra = 60000,
                                       ProfessionalTax = 100,
                                       SpecialAllowance = 10
                                   };

            Assert.AreEqual(40000, annualSalary.CalculateHraExemption(taxPayer.FromMetro, taxPayer.RentPaid));
        }
Beispiel #22
0
 public void ShouldNotCalculateHraExemptionIfHraComponentIsNotAvailable()
 {
     var taxPayer = new User(30000, true, Gender.Male);
     var annualSalary = new AnnualSalary
                            {
                                Basic = 100000,
                                Hra = 0,
                                ProfessionalTax = 100,
                                SpecialAllowance = 10
                            };
     Assert.Throws<Exception>(() => annualSalary.CalculateHraExemption(taxPayer.FromMetro, taxPayer.RentPaid));
 }
Beispiel #23
0
        public void ShouldReturnTotalPpfInvestmentAsDeductionIfPpfInvestmentIsWithinPpfCapAndNoOtherInvestmentIsMade()
        {
            var investments = new Chapter6Investments();
            const double ppfContribution = 69999.99;
            investments.Add(new PublicProvidentFund(ppfContribution));

            var salary = new AnnualSalary {Epf = 0};
            TaxStatement ts = new TaxStatement(salary, null) { Chapter6Investments = investments };
            Assert.AreEqual(ppfContribution, ts.GetChapter6Deductions(), 0.01);
        }
Beispiel #24
0
        public void ShouldReturnZeroDeductionIfInvestmentIsNotAvailableAndEpfIsZero()
        {
            var salary = new AnnualSalary {Epf = 0.0};
            TaxStatement ts = new TaxStatement(salary, null);
            Assert.AreEqual(0.0, ts.GetChapter6Deductions(), 0.01);

            salary = new AnnualSalary();
            ts = new TaxStatement(salary, null) { Chapter6Investments = new Chapter6Investments() };
            Assert.AreEqual(0.0, ts.GetChapter6Deductions(), 0.01);
        }
Beispiel #25
0
        public void ShouldSaveTheInvestmentAlongWithTaxStatement()
        {
            var taxPayer = new User(0, true, Gender.Female);
            TaxSlabs ts = TaxSlabs.GetInstance();
            AnnualSalary asal = new AnnualSalary
            {
                Basic = 600000,
                Hra = 100000
            };
            TaxStatement stmt = new TaxStatement(asal, taxPayer);
            stmt.Chapter6Investments=  new Chapter6Investments();
            LifeInsurance LICInvestment=new LifeInsurance(10000);
            stmt.Chapter6Investments.Add(LICInvestment);
            LICInvestment.TaxStatement = stmt;

            Repository taxStatementRepo=new Repository();
            taxStatementRepo.Save(stmt);

            Assert.AreEqual(LICInvestment.GetAmount(), taxStatementRepo.GetInvestmentDetails(stmt.Id).GetAmount());
        }
Beispiel #26
0
 public void ShouldReturnNoDeductionIfEpfIsNotAvailableAndNoOtherInvestmentIsMade()
 {
     var salary = new AnnualSalary {Epf = 0};
     TaxStatement ts = new TaxStatement(salary, null);
     Assert.AreEqual(0, ts.GetChapter6Deductions(), 0.01);
 }
Beispiel #27
0
        public void ShouldReturnSumOfLifeInsuranceAndElssIfBothAreWithinCapAndOtherInvestmentAreZero()
        {
            var investments = new Chapter6Investments();
            investments.Add(new LifeInsurance(30000));
            investments.Add(new Elss(60000));

            var salary = new AnnualSalary {Epf = 0};
            TaxStatement ts = new TaxStatement(salary, null) { Chapter6Investments = investments };
            Assert.AreEqual(90000.0, ts.GetChapter6Deductions(), 0.01);
        }
Beispiel #28
0
 public void MustCalculateNetPayableTaxWithOnlyAnnualSalary()
 {
     var taxPayer = new User(50000, true, Gender.Female);
     TaxSlabs ts = TaxSlabs.GetInstance();
     AnnualSalary asal = new AnnualSalary
                            {
                                Basic = 200000.50,
                                Hra = 1000,
                                ProfessionalTax = 100,
                                SpecialAllowance = 10
                            };
     TaxStatement stmt = new TaxStatement(asal,taxPayer);
     Assert.AreEqual(1891.05d, stmt.CalculateNetPayableTax());
 }
Beispiel #29
0
 public TaxStatement(AnnualSalary annualSalary, User taxPayer)
 {
     AnnualSalary = annualSalary;
     TaxPayer     = taxPayer;
 }