예제 #1
0
 public void HasItemsMustReturnTrueIfItemsWereAdded()
 {
     OtherIncomes ois = new OtherIncomes();
     ois.Add(new OtherIncomeItem("Interet", 12000.0));
     ois.Add(new OtherIncomeItem("Rental", 12000.0));
     Assert.IsTrue(ois.HasItems);
 }
예제 #2
0
        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);
        }
예제 #3
0
 public void ShouldGetTotalAmountForOtherIncomeItems()
 {
     OtherIncomes ois = new OtherIncomes();
     ois.Add(new OtherIncomeItem("Interet", 12000.0));
     ois.Add(new OtherIncomeItem("Rental", 12000.0));
     Assert.AreEqual(24000.00m, ois.CalculateTotalAmount());
 }
예제 #4
0
 public void ShouldGetCountIfItemsAreAdded()
 {
     OtherIncomes ois = new OtherIncomes();
     ois.Add(new OtherIncomeItem("Interet", 12000.0));
     ois.Add(new OtherIncomeItem("Rental", 12000.0));
     Assert.AreEqual(2, ois.Count);
 }
예제 #5
0
        public void ShouldGetOtherIncomeItemsWhenItemsAreAdded()
        {
            OtherIncomes ois = new OtherIncomes();

            IList<OtherIncomeItem> items = new List<OtherIncomeItem>() { new OtherIncomeItem("Interet", 12000.0),  new OtherIncomeItem("Rental", 12000.0) };
            foreach (OtherIncomeItem otherIncomeItem in items)
            {
                ois.Add(otherIncomeItem);
            }

            Assert.AreEqual(24000.00m, ois.CalculateTotalAmount());
            Assert.IsNotNull(ois.GetItems());
            foreach (OtherIncomeItem otherIncomeItem in ois.GetItems())
            {
                Assert.IsTrue(items.Contains(otherIncomeItem));
            }
        }
예제 #6
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);
        }
예제 #7
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);
        }
예제 #8
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);
        }
예제 #9
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);
        }
예제 #10
0
 public void ShouldGetZeroCountIfNoItemsAreAdded()
 {
     OtherIncomes ois = new OtherIncomes();
     Assert.AreEqual(0, ois.Count);
 }
예제 #11
0
 public void MustBeAbleToAddAnOtherIncomeItem()
 {
     OtherIncomes ois = new OtherIncomes();
     ois.Add(new OtherIncomeItem("ABCD", 12.0));
     Assert.AreEqual(1, ois.Count);
 }
예제 #12
0
 public void HasItemsMustReturnFalseIfNoItemsWereAdded()
 {
     OtherIncomes ois = new OtherIncomes();
     Assert.IsFalse(ois.HasItems);
 }
예제 #13
0
 public void CannotAddNullOtherIncomeItem()
 {
     OtherIncomes ois = new OtherIncomes();
     Assert.Throws<ArgumentNullException>(() => ois.Add(null));
 }