示例#1
0
        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);
            }
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }
示例#7
0
        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);
        }
示例#8
0
        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));
        }
示例#9
0
        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);
        }
示例#10
0
        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);
            }
        }