Beispiel #1
0
        public void AnyDuplicatedUpperBound_ReutrnTrueWhenUpperBoundHasSameValue(List <TaxBand> taxBands, bool expectedResult)
        {
            var helper = new TaxBandHelper();
            var anyDuplicatedUpperBound = helper.AnyDuplicatedUpperBound(taxBands);

            anyDuplicatedUpperBound.Should().Be(expectedResult);
        }
Beispiel #2
0
        public void AnyTailBand_ReutrnTrueWhenBandWithNullUpperBondPresent(List <TaxBand> taxBands, bool expectedResult)
        {
            var helper = new TaxBandHelper();
            var anyDuplicatedUpperBound = helper.AnyTailBand(taxBands);

            anyDuplicatedUpperBound.Should().Be(expectedResult);
        }
Beispiel #3
0
        public void Sort_ReturnTaxBandSortedByUpperBound(List <TaxBand> taxBands, List <TaxBand> expectedResult)
        {
            var helper         = new TaxBandHelper();
            var sortedTaxBands = helper.Sort(taxBands);

            sortedTaxBands.Should().HaveCount(3);
            sortedTaxBands.Should().Equal(expectedResult);
        }
Beispiel #4
0
        public static decimal GetTaxRate(decimal income, FileStatusEnum fileStatus)
        {
            if (fileStatus == FileStatusEnum.Single)
            {
                return(TaxBandHelper.SingleBands().First(b => income >= b.Lower && income <= b.Upper).Rate);
            }

            if (fileStatus == FileStatusEnum.MarriedJointly)
            {
                return(TaxBandHelper.MarriedJointBands().First(b => income >= b.Lower && income <= b.Upper).Rate);
            }

            throw new Exception($"FileStatus Unknown, unable to continue.");
        }