Example #1
0
        public void IncomeTaxIsCalculatedProperlyForProperData(decimal hours, decimal rate, decimal expected)
        {
            // Arrange
            var sut = new GermanySalaryCalculator {
                GrossAmount = hours * rate
            };

            // Act
            var result = sut.CalculateIncomeTax();

            // Assert
            Assert.AreEqual(expected, result);
        }
Example #2
0
        public void UniversalSocialChargeIsCalculatedProperlyForProperData(decimal hours, decimal rate, decimal expected)
        {
            // Arrange
            var sut = new GermanySalaryCalculator {
                GrossAmount = hours * rate
            };

            // Act
            var result = sut.CalculateUniversalSocialCharge();

            // Assert
            Assert.AreEqual(expected, result);
        }
Example #3
0
        public void PensionIsEqualZeroWhenHoursOrRateIsNegative(decimal hours, decimal rate)
        {
            // Arrange
            var sut = new GermanySalaryCalculator {
                GrossAmount = hours * rate
            };
            decimal expected = 0;

            // Act
            var result = sut.CalculatePension();

            // Assert
            Assert.AreEqual(expected, result);
        }
Example #4
0
        public void SalaryIsCalculatedProperlyForGermany(
            decimal hours,
            decimal rate,
            decimal expectedIncomeTax,
            decimal expectedUsc,
            decimal expectedPension,
            decimal expectedNetAmount,
            decimal expectedGrossAmount)
        {
            // Arrange
            var sut = new GermanySalaryCalculator();

            // Act
            var result = sut.GetCalculatedSalary(hours, rate);

            // Assert
            Assert.AreEqual(expectedIncomeTax, result.IncomeTax);
            Assert.AreEqual(expectedUsc, result.UniversalSocialCharge);
            Assert.AreEqual(expectedPension, result.Pension);
            Assert.AreEqual(expectedNetAmount, result.NetAmount);
            Assert.AreEqual(expectedGrossAmount, result.GrossAmount);
        }
Example #5
0
        private static ISalaryCalculator GetCalculatorType(string location)
        {
            ISalaryCalculator calculator;

            switch (location.Trim().ToLower())
            {
            case "ireland":
                calculator = new IrelandSalaryCalculator();
                break;

            case "italy":
                calculator = new ItalaySalaryCalculator();
                break;

            case "germany":
                calculator = new GermanySalaryCalculator();
                break;

            default:
                calculator = new NormalSalaryCalculator();
                break;
            }
            return(calculator);
        }