AddDonation() public method

public AddDonation ( DonationUnder80G donationUnder80G ) : void
donationUnder80G DonationUnder80G
return void
コード例 #1
0
ファイル: TestRepository.cs プロジェクト: bagheera/tax
        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));
        }
コード例 #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);
 }
コード例 #3
0
ファイル: TestRepository.cs プロジェクト: bagheera/tax
        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);
        }
コード例 #4
0
ファイル: TestTaxStatement.cs プロジェクト: bagheera/tax
 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);
 }
コード例 #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);
 }
コード例 #6
0
 public void DeductionShouldBeEqualToHalfOfHalfExemptDeductionWhenOneHalfExemptDonationUnder80GIsAdded()
 {
     DonationsUnder80G donationsUnder80G = new DonationsUnder80G();
     donationsUnder80G.AddDonation(new HalfExemptDonation(10));
     Assert.AreEqual(5, donationsUnder80G.GetDeduction(), 0.001);
 }