public void Obliczenia_dla_wynagrodzenie_netto (decimal salary, bool higherCostOfGettingIncome, bool hasHealthInsurance, decimal exceptetBrutto, decimal exceptetPit, decimal exceptetInsurance) { //Arrange var contractBuilder = new ContractBuilder(); contractBuilder.TypeOfContract(TypeOfContract.UmowaZlecenie); contractBuilder.Salary(salary, SalaryFrom.Net); if (higherCostOfGettingIncome) { contractBuilder.HigherCostOfGettingIncome(true); } if (hasHealthInsurance) { contractBuilder.HealthInsurance(); } var contract = contractBuilder.Build(); //Act var calculator = new SalaryCalculator(contract); var result = calculator.Calculator(); //Assert Assert.Equal(exceptetBrutto, result.GrossSalary); Assert.Equal(exceptetPit, result.SalaryCosts.First(x => x.CostName == "zaliczka na PIT").CostValue); if (hasHealthInsurance) { Assert.Equal(exceptetInsurance, result.SalaryCosts.First(x => x.CostName == "ubezpieczenie zdrowotne").CostValue); } }
public void Obliczenia_dla_wynagrodzenie_2000_brutto() { //Arrange var contract = new ContractBuilder() .TypeOfContract(TypeOfContract.UmowaZlecenie) .Salary(2000, SalaryFrom.Gross) .Build(); //Act var calculator = new SalaryCalculator(contract); var result = calculator.Calculator(); //Assert Assert.Equal(1712, result.NetSalary); Assert.Equal(2000, result.GrossSalary); }
public void Sprawdznie_Kalkulatora_dla_kilku_wariantow_wynagrodzenia_z_50_procentowym_kosztem_uzyskania_dochodu (decimal _salary, bool _higherCost, decimal ExceptetResult) { //Arrange var contract = new ContractBuilder() .TypeOfContract(TypeOfContract.UmowaODzielo) .Salary(_salary, SalaryFrom.Net) .HigherCostOfGettingIncome(_higherCost) .Build(); //Act var calculator = new SalaryCalculator(contract); var result = calculator.Calculator(); //Assert Assert.Equal(ExceptetResult, result.GrossSalary); }
public void Obliczenia_dla_wynagrodzenie_2000_netto_z_Zaliczka_na_PIT() { var contract = new ContractBuilder() .TypeOfContract(TypeOfContract.UmowaODzielo) .Salary(2000, SalaryFrom.Net) .HigherCostOfGettingIncome(false) .Build(); var calculator = new SalaryCalculator(contract); var result = calculator.Calculator(); Assert.Equal(2000, result.NetSalary); Assert.Equal(2336.45M, result.GrossSalary); Assert.Equal("zaliczka na PIT", result.SalaryCosts.First().CostName); Assert.Equal(360, result.SalaryCosts.First().CostValue); }
public void Obliczenia_dla_wynagrodzenie_2000_netto() { //Arrange var contract = new ContractBuilder() .TypeOfContract(TypeOfContract.UmowaODzielo) .Salary(2000, SalaryFrom.Net) .HigherCostOfGettingIncome(false) .Build(); //Act var calculator = new SalaryCalculator(contract); var result = calculator.Calculator(); //Assert Assert.Equal(2000, result.NetSalary); Assert.Equal(2336.45M, result.GrossSalary); }
public void Obliczenia_dla_wynagrodzenie_2000_brutto_z_50_procentowym_kosztem_uzyskania_dochodu() { //Arrange var contract = new ContractBuilder() .TypeOfContract(TypeOfContract.UmowaZlecenie) .Salary(2000, SalaryFrom.Gross) .HigherCostOfGettingIncome(true) .Build(); //Act var calculator = new SalaryCalculator(contract); var result = calculator.Calculator(); //Assert Assert.Equal(1820, result.NetSalary); Assert.Equal(2000, result.GrossSalary); Assert.Equal(180, result.SalaryCosts.First(x => x.CostName == "zaliczka na PIT").CostValue); }
public void Obliczenia_dla_wynagrodzenie_2000_brutto_z_skladka_zdrowotna() { //Arrange var contract = new ContractBuilder() .TypeOfContract(TypeOfContract.UmowaZlecenie) .Salary(2000, SalaryFrom.Gross) .HealthInsurance() .Build(); //Act var calculator = new SalaryCalculator(contract); var result = calculator.Calculator(); //Assert Assert.Equal(1687, result.NetSalary); Assert.Equal(2000, result.GrossSalary); Assert.Equal(133, result.SalaryCosts.First(x => x.CostName == "zaliczka na PIT").CostValue); Assert.Equal(180, result.SalaryCosts.First(x => x.CostName == "ubezpieczenie zdrowotne").CostValue); }
public IHttpActionResult salaryCalculator([FromBody] FormSalaryCalculatorVM value) { if (value == null) { return(BadRequest()); } var contract = new ContractBuilder() .TypeOfContract(value.typeOfContract) .Salary(value.salary, value.salaryFrom) .HigherCostOfGettingIncome(value.higherCostOfGettingIncome) .HealthInsurance(value.healthInsurance) .Build(); var calculator = new SalaryCalculator(contract); var result = calculator.Calculator(); return(Ok(result)); }
public void Obliczenia_dla_wynagrodzenie_2000_brutto_50_koszty_dochodu_oraz_skladtka_zdrowotna() { //Arrange var contractBuilder = new ContractBuilder() .TypeOfContract(TypeOfContract.UmowaZlecenie) .Salary(2000, SalaryFrom.Gross) .HigherCostOfGettingIncome(true) .HealthInsurance() .Build(); //Act var calculator = new SalaryCalculator(contractBuilder); var result = calculator.Calculator(); //Assert Assert.Equal(1795, result.NetSalary); Assert.Equal(2000, result.GrossSalary); Assert.Equal(25, result.SalaryCosts.First(x => x.CostName == "zaliczka na PIT").CostValue); Assert.Equal(180, result.SalaryCosts.First(x => x.CostName == "ubezpieczenie zdrowotne").CostValue); }
public void Sprawdzenie_Kalkulatora_dla_kilku_wariantow_wynagrodzenia (decimal _salary, SalaryFrom _salaryFrom, decimal ExceptetResult) { //Arrange var contract = new ContractBuilder() .TypeOfContract(TypeOfContract.UmowaODzielo) .Salary(_salary, _salaryFrom) .HigherCostOfGettingIncome(false) .Build(); //Act var calculator = new SalaryCalculator(contract); var result = calculator.Calculator(); //Assert if (_salaryFrom == SalaryFrom.Gross) { Assert.Equal(ExceptetResult, result.NetSalary); } if (_salaryFrom == SalaryFrom.Net) { Assert.Equal(ExceptetResult, result.GrossSalary); } }