예제 #1
0
        public void CalculateIncomeTax(Contributor contributer)
        {
            var discount   = ((contributer.NumberDependents * _percentDiscounte) / 100) * _salary;
            var freeSalary = contributer.Salary - discount;
            var incomeTax  = _aliquota.GetIncomeTax(_salary, freeSalary);

            contributer.SetIncomeTax(incomeTax);
        }
예제 #2
0
        public void AliquotaErradaSemProxima()
        {
            //Arrange
            var aliquota      = new IncomeTaxRate(15, 5);
            var salarioMinimo = 1000;
            var rendaLiquida  = 6000;

            //Act
            var valor = aliquota.GetIncomeTax(salarioMinimo, rendaLiquida);

            //Assert
            valor.Should().Be(0);
        }
예제 #3
0
        public void AliquotaMaxima()
        {
            //Arrange
            var aliquota      = new IncomeTaxRate(27.5m);
            var salarioMinimo = 1000;
            var rendaLiquida  = 40000;

            //Act
            var valor         = aliquota.GetIncomeTax(salarioMinimo, rendaLiquida);
            var valorEsperado = ((rendaLiquida * 27.5m) / 100);

            //Assert
            valor.Should().Be(valorEsperado);
        }
예제 #4
0
        public void AliquotaCorretaComProxima()
        {
            //Arrange
            var aliquota = new IncomeTaxRate(15, 5)
                           .NextRange(new IncomeTaxRate(22.5m, 7));
            var salarioMinimo = 1000;
            var rendaLiquida  = 4000;

            //Act
            var valor         = aliquota.GetIncomeTax(salarioMinimo, rendaLiquida);
            var valorEsperado = ((rendaLiquida * 15) / 100);

            //Assert
            valor.Should().Be(valorEsperado);
        }