public void CalculateTax_ValidInputAge0to60_Slab3UpperBoundryValue_returnTax() { int age = 60; double salary = 1000000; double expectedTax = (((salary - 500000) * 20) / 100) + 12500; var t1 = new TaxCalculatorNS.TaxCalculator(age, salary); var tax = t1.CalculateTax(); Assert.AreEqual(tax, expectedTax); }
public void CalculateTax_ValidInputAge0to60_Slab2LowerBoundryValue_returnTax() { int age = 0; double salary = 250001; double expectedTax = (salary * 5) / 100; var t1 = new TaxCalculatorNS.TaxCalculator(age, salary); var tax = t1.CalculateTax(); Assert.AreEqual(tax, expectedTax); }
public void CalculateTax_ValidInputAge0to60_Slab1_returnTax() { int age = 22; double salary = 100000; double expectedTax = 0.0; var t1 = new TaxCalculatorNS.TaxCalculator(age, salary); var tax = t1.CalculateTax(); Assert.AreEqual(tax, expectedTax); }
public void CalculateTax_ValidInputAge80Plus_Slab3LowerBoundryValue_returnTax() { int age = 81; double salary = 1000001; double expectedTax = (((salary - 1000000) * 30) / 100) + 100000; var t1 = new TaxCalculatorNS.TaxCalculator(age, salary); var tax = t1.CalculateTax(); Assert.AreEqual(tax, expectedTax); }
public void CalculateTax_ValidInputAge80Plus_Slab2_returnTax() { int age = 85; double salary = 600000; double expectedTax = (salary * 20) / 100; var t1 = new TaxCalculatorNS.TaxCalculator(age, salary); var tax = t1.CalculateTax(); Assert.AreEqual(tax, expectedTax); }
public void CalculateTax_ValidInputAge80Plus_Slab1UpperBoundryValue_returnTax() { int age = 81; double salary = 500000; double expectedTax = 0.0; var t1 = new TaxCalculatorNS.TaxCalculator(age, salary); var tax = t1.CalculateTax(); Assert.AreEqual(tax, expectedTax); }
public void CalculateTax_ValidInputAge61to80_Slab4BoundryValue_returnTax() { int age = 65; double salary = 1500000; double expectedTax = (((salary - 1000000) * 30) / 100) + 110000; var t1 = new TaxCalculatorNS.TaxCalculator(age, salary); var tax = t1.CalculateTax(); Assert.AreEqual(tax, expectedTax); }
static void Main(string[] args) { bool exit = false; while (!exit) { try { int age = 0; double salary = 0; bool isAgeNegative = true; bool isSalaryNegative = true; while (isAgeNegative) { Console.WriteLine("Please enter your age"); age = Convert.ToInt32(Console.ReadLine()); if (age >= 0) { isAgeNegative = false; } else { Console.WriteLine(); Console.WriteLine("Age cannot be negative"); } } while (isSalaryNegative) { Console.WriteLine("Please enter your anual salary"); salary = Convert.ToDouble(Console.ReadLine()); if (salary >= 0) { isSalaryNegative = false; } else { Console.WriteLine(); Console.WriteLine("Salary cannot be negative"); } } Console.WriteLine(); TaxCalculator t1 = new TaxCalculator(age, salary); Console.WriteLine("Calculated tax : Rs {0}", t1.CalculateTax()); Console.WriteLine(); Console.WriteLine("Do you want to exit?"); Console.WriteLine("Type : yes or no"); string answer = Console.ReadLine(); if (answer == "yes") { exit = true; } } catch (FormatException e) { Console.WriteLine(e.Message); } catch (Exception e) { Console.WriteLine(e.Message); } } }