Example #1
0
        public void HandicapAdjustmentCalculatorService_CalculateHandicapAdjustment_IncreasingScores_CalculationSuccessful(Decimal exactHandicap, ScoreListIndex holeScoresIndex, Decimal adjustment)
        {
            IHandicapAdjustmentCalculatorService service = new HandicapAdjustmentCalculatorService();

            List <HandicapAdjustment> adjustments = service.CalculateHandicapAdjustment(exactHandicap, HandicapAdjustmentCalculatorServiceTests.CSSScore, this.ScoreList[(Int32)holeScoresIndex]);

            adjustments.Count.ShouldBe(1);
            adjustments[0].TotalAdjustment.ShouldBe(adjustment);
        }
Example #2
0
        public void HandicapAdjustmentCalculatorService_CalculateHandicapAdjustment_CuttingScores_CategoryChange_CalculationSuccessful()
        {
            IHandicapAdjustmentCalculatorService service = new HandicapAdjustmentCalculatorService();

            Dictionary <Int32, Int32> sixHandicapHoleScoresCut = new Dictionary <Int32, Int32>()
            {
                { 1, 4 }, { 2, 4 }, { 3, 3 }, { 4, 4 }, { 5, 4 }, { 6, 5 }, { 7, 3 }, { 8, 4 }, { 9, 3 },
                { 10, 4 }, { 11, 4 }, { 12, 4 }, { 13, 5 }, { 14, 3 }, { 15, 4 }, { 16, 4 }, { 17, 4 }, { 18, 4 }
            };
            Decimal exactHandicap = 6.1m;

            List <HandicapAdjustment> adjustments = service.CalculateHandicapAdjustment(exactHandicap, HandicapAdjustmentCalculatorServiceTests.CSSScore, sixHandicapHoleScoresCut);

            adjustments.Count.ShouldBe(2);
            adjustments[0].TotalAdjustment.ShouldBe(-0.8m);
            adjustments[0].AdjustmentValuePerStroke.ShouldBe(0.2m);
            adjustments[0].NumberOfStrokesBelowCss.ShouldBe(4);
            adjustments[1].TotalAdjustment.ShouldBe(-0.2m);
            adjustments[1].AdjustmentValuePerStroke.ShouldBe(0.1m);
            adjustments[1].NumberOfStrokesBelowCss.ShouldBe(2);
        }