public void BuildSalaryShouldBuildByGivenAmountAndCurrency()
        {
            Salary salary = SalaryProvider.Get();
            Salary result = _service.BuildSalary(salary.Amount.ToString(), salary.Currency.ToString());

            result.Should().Match <Salary>(r => r.Amount == salary.Amount && r.Currency == salary.Currency);
        }
        public void BuildSalaryShouldBuildWithDefaultCurrency(string currency)
        {
            Salary salary = SalaryProvider.Get();
            Salary result = _service.BuildSalary(salary.Amount.ToString(), currency);

            result.Should().Match <Salary>(r => r.Amount == salary.Amount && r.Currency == Currency.IDR);
        }
Exemple #3
0
        public void GetNetSalaryShouldCalculateWithSalaryOnNoTaxationThreshold()
        {
            decimal grossSalaryAmount = _config.NoTaxationThreshold;

            Salary grossSalary = SalaryProvider.Get(grossSalaryAmount, Currency.IDR);
            Salary netSalary   = _calculator.GetNetSalary(grossSalary);

            netSalary.Amount.Should().Be(grossSalaryAmount);
        }
        public void GetNetSalarySouldCallTaxCalculator()
        {
            Salary grossSalary = SalaryProvider.Get();

            ITaxCalculator taxCalculator = Mock.Of <ITaxCalculator>();

            Mock.Get(_taxCalculatorFactory)
            .Setup(tcf => tcf.GetForCurrency(grossSalary.Currency))
            .Returns(taxCalculator);

            _service.GetNetSalary(grossSalary);

            Mock.Get(taxCalculator).Verify(tc => tc.GetNetSalary(grossSalary), Times.Once);
        }
Exemple #5
0
        public void GetNetSalaryShouldCalculateWithSalaryAboveSocialContributionsThreshold()
        {
            decimal grossSalaryAmount = _config.NoTaxationThreshold + (_config.SocialContributionsThreshold * 2M);

            Salary grossSalary = SalaryProvider.Get(grossSalaryAmount, Currency.IDR);
            Salary netSalary   = _calculator.GetNetSalary(grossSalary);

            decimal taxableAmount     = grossSalary.Amount - _config.NoTaxationThreshold;
            decimal expectedNetAmount =
                grossSalary.Amount -
                (taxableAmount * (_config.IncomeTaxPercent / 100M)) -
                (_config.SocialContributionsThreshold * (_config.SocialContributionsPercent / 100M));

            netSalary.Amount.Should().Be(expectedNetAmount);
        }