コード例 #1
0
        public void GetNewBalance_GivenCalculatedPenaltyGreaterThanOrEqualToMaximumPenaltyValue_AssessesMaximumPenalty()
        {
            GivenCalculatedPenaltyAtOrAboveCap();
            var penalty = new ProportionalPenaltyWithCap(_penaltyPercentage, _maximumPenalty);

            var finalBalance = penalty.GetNewBalance(_initialBalance);

            Assert.That(finalBalance, Is.EqualTo(_initialBalance - _maximumPenalty));
        }
コード例 #2
0
        public void GetNewBalance_GivenCalculatedPenaltyBelowMaximumPenaltyValue_AssessesCalculatedPenalty()
        {
            GivenCalculatedPenaltyBelowCap();
            var penalty         = new ProportionalPenaltyWithCap(_penaltyPercentage, _maximumPenalty);
            var expectedPenalty = _initialBalance * _penaltyPercentage / 100;

            var finalBalance = penalty.GetNewBalance(_initialBalance);

            Assert.That(finalBalance, Is.EqualTo(_initialBalance - expectedPenalty));
        }