Ejemplo n.º 1
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));
        }
Ejemplo n.º 2
0
 public void DeductionShouldBeEqualToApprpriateDonationUnder80GIsAddedWhenOneFullyExemptAndOneHalfExemptIsAdded()
 {
     DonationsUnder80G donationsUnder80G = new DonationsUnder80G();
     donationsUnder80G.AddDonation(new HalfExemptDonation(10));
     donationsUnder80G.AddDonation(new FullyExemptDonation(10));
     Assert.AreEqual(15, donationsUnder80G.GetDeduction(), 0.001);
 }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
 public void TotalDeductionShouldBeEqualToApprpriateSumOfDonationsApplicableToIndividualDonations()
 {
     DonationsUnder80G donationsUnder80G = new DonationsUnder80G();
     donationsUnder80G.AddDonation(new HalfExemptDonation(10));
     donationsUnder80G.AddDonation(new HalfExemptDonation(10));
     donationsUnder80G.AddDonation(new FullyExemptDonation(10));
     donationsUnder80G.AddDonation(new FullyExemptDonation(10));
     Assert.AreEqual(30, donationsUnder80G.GetDeduction(), 0.001);
 }
Ejemplo n.º 6
0
 public void DeductionShouldBeZeroWhenNoDonationUnder80G()
 {
     DonationsUnder80G donationsUnder80G = new DonationsUnder80G();
     Assert.AreEqual(0,donationsUnder80G.GetDeduction(),0.001);
 }
Ejemplo n.º 7
0
 public void DeductionShouldBeEqualToHalfOfHalfExemptDeductionWhenOneHalfExemptDonationUnder80GIsAdded()
 {
     DonationsUnder80G donationsUnder80G = new DonationsUnder80G();
     donationsUnder80G.AddDonation(new HalfExemptDonation(10));
     Assert.AreEqual(5, donationsUnder80G.GetDeduction(), 0.001);
 }