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 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); }
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 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); }
protected DonationUnder80G(double amount, TaxStatement taxStatement) { TaxStatement = taxStatement; if (amount>=0) { this.Amount = amount; } else { throw new ArgumentOutOfRangeException("Donation cannot be negative"); } }
protected DonationUnder80G(double amount, TaxStatement taxStatement) { TaxStatement = taxStatement; if (amount >= 0) { this.Amount = amount; } else { throw new ArgumentOutOfRangeException("Donation cannot be negative"); } }
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); }
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); }
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); }
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); }
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); }
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()); }
public void MustHaveAnAnnualSalary() { AnnualSalary asal = new AnnualSalary(); TaxStatement stmt = new TaxStatement(asal,null); Assert.AreSame(asal, stmt.AnnualSalary); }
protected FullyExemptDonation(double amount, TaxStatement taxStatement) : base(amount, taxStatement) { }
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); }
public void ShouldReturnNoDeductionIfEpfIsNotAvailableAndNoOtherInvestmentIsMade() { var salary = new AnnualSalary {Epf = 0}; TaxStatement ts = new TaxStatement(salary, null); Assert.AreEqual(0, ts.GetChapter6Deductions(), 0.01); }
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); }
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); }
protected HalfExemptDonation(double amount, TaxStatement taxStatement) : base(amount, taxStatement) { }
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); }
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); }
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()); }