Example #1
0
 public void CalculateIncomeTax_NoBaseTaxAmountSpecified_ReturnsTaxAmountOverMinIncome()
 {
     //= 7,491.25 / 12 months
     //= 624.27083333333333333333333333333
     // arrange, act & assert
     TaxRate.Create(37001M, maxIncome: 87000M, rateValue: 0.325M)
     .CalculateIncomeTax(60050M).ShouldBe(624M);
 }
Example #2
0
        public void CalculateIncomeTax_RateForDollarsOverMinIncomeNotSpecified_ReturnsBaseTaxAmount()
        {
            // arrange
            const decimal wholeBaseTaxAmountPerMonth = 298M;

            // act & assert
            TaxRate.Create(37001M, 87000M, baseTaxAmount: 3572M)
            .CalculateIncomeTax(60050M)
            .ShouldBe(wholeBaseTaxAmountPerMonth);
        }
Example #3
0
        public void CalculateTaxAmountOverMinIncome_RateValueSet_ReturnsTaxOverMinIncome()
        {
            const decimal salary = 60050M;//$60,050
            //(60,050 - 37,000) x 0.325
            //
            var taxRate = TaxRate.Create(37001M, 87000M, rateValue: 0.325M);

            taxRate.CalculateTaxAmountOverMinIncome(salary)
            .ShouldBe(7491.25M);
        }
Example #4
0
 public void CalculateIncomeTax()
 {
     //$87,001 - $180,000 $19,822 plus 37c for each $1 over $87,000
     TaxRate.Create(87001M, 180000M, 0.37M, 19822M).CalculateIncomeTax(120000M).ShouldBe(2669M);
     TaxRate.Create(37001M, 87000M, 0.325M, 3572M).CalculateIncomeTax(60050M).ShouldBe(922M);
 }
Example #5
0
 public void IsWithinIncomeRange_SalaryWithinRange_ReturnsTrue(decimal minIncome, decimal?maxIncome, decimal income, bool result)
 {
     TaxRate.Create(minIncome, maxIncome).IsWithinIncomeRange(income).ShouldBe(result);
 }
Example #6
0
 public void Ctor_InvalidIncomeRanges_ThrowsArgumentOutOfRangeException()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => TaxRate.Create(-1M, 0M, 0M, 0M));
     Assert.Throws <ArgumentOutOfRangeException>(() => TaxRate.Create(0M, -1M, 0M, 0M));
     Assert.Throws <ArgumentOutOfRangeException>(() => TaxRate.Create(0M, -1M, -1M, 0M));
 }