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 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(); }