public void GetNetSalary_GivenGrossSalaryAndDeductionsAndTaxYear_ReturnsCorrectTotal() { // Arrange var employee = new Employee { Age = 30 }; var paySlipBuilder = new PaySlipBuilder(employee); var year = 2019; var expected = 27795.07m; paySlipBuilder.AddGrossSalary(40000m); paySlipBuilder.AddPension(5000m); paySlipBuilder.AddVitality(250m); paySlipBuilder.AddParking(150m); // Act var paySlip = paySlipBuilder.Build(); // Assert Assert.Equal(expected, Math.Round(paySlip.GetNetSalary(year), 2)); }
public void GetTotalDeductions_GivenGrossSalaryAndDeductions_ReturnsCorrectTotal() { // Arrange var employee = new Employee { Age = 30 }; var paySlipBuilder = new PaySlipBuilder(employee); var expected = 12204.93m; paySlipBuilder.AddGrossSalary(40000m); paySlipBuilder.AddPension(5000m); paySlipBuilder.AddVitality(250m); paySlipBuilder.AddParking(150m); // Act var paySlip = paySlipBuilder.Build(); // Assert Assert.Equal(expected, Math.Round(paySlip.GetTotalDeductions(), 2)); }
public void GetUif_GivenBelowCeilingGrossSalary_ReturnsCalculatedUifValue() { // Arrange var employee = new Employee { Age = 30 }; var paySlipBuilder = new PaySlipBuilder(employee); var expected = 140; paySlipBuilder.AddGrossSalary(14000m); // Act var paySlip = paySlipBuilder.Build(); // Assert Assert.Equal(expected, paySlip.GetUif()); }
public void GetUif_GivenAboveCeilingGrossSalary_ReturnsMaximumUifValue() { // Arrange var employee = new Employee { Age = 30 }; var paySlipBuilder = new PaySlipBuilder(employee); var expected = 148.72m; paySlipBuilder.AddGrossSalary(40000m); // Act var paySlip = paySlipBuilder.Build(); // Assert Assert.Equal(expected, paySlip.GetUif()); }
public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); var employee = new Employee { Id = 8001185051083, FirstName = "Stuart", Surname = "Green", Age = 40 }; var paySlipBuilder = new PaySlipBuilder(employee); paySlipBuilder.AddGrossSalary(40000); paySlipBuilder.AddMedicalAid(2500); paySlipBuilder.AddPension(5000); paySlipBuilder.AddParking(150); paySlipBuilder.AddVitality(250); var paySlip = paySlipBuilder.Build(); }
public void GetTotalBenefits_GivenBenefits_ReturnsCorrectTotal() { // Arrange var employee = new Employee { Age = 30 }; var paySlipBuilder = new PaySlipBuilder(employee); var expected = 5000m; paySlipBuilder.AddMedicalAid(2500m); paySlipBuilder.AddPension(5000m); // Act var paySlip = paySlipBuilder.Build(); // Assert Assert.Equal(expected, paySlip.GetTotalBenefits()); }
public void GetCostToCompany_GivenGrossSalaryAndBenefits_ReturnsCorrectTotal() { // Arrange var employee = new Employee { Age = 30 }; var paySlipBuilder = new PaySlipBuilder(employee); var expected = 45000m; paySlipBuilder.AddGrossSalary(40000m); paySlipBuilder.AddMedicalAid(2500m); paySlipBuilder.AddPension(5000m); // Act var paySlip = paySlipBuilder.Build(); // Assert Assert.Equal(expected, paySlip.GetCostToCompany()); }