public void NoBaseScore_GetBonus_Zero()
        {
            // Arrange
            AbilityScore abilityScore = new AbilityScore();

            abilityScore.BaseScore = null;

            // Act
            var bonus = abilityScore.GetBonus();

            // Assert
            Assert.AreEqual(0, bonus,
                            "An ability score with a null BaseScore should have a bonus of zero.");
        }
        public void BaseScoreSix_Aggregates()
        {
            // Arrange
            AbilityScore abilityScore = new AbilityScore();

            abilityScore.BaseScore = 6;

            // Assert
            Assert.IsTrue(abilityScore.GetTotal().HasValue,
                          "Ability scores with a non-null base score should always have a total.");
            Assert.AreEqual(6, abilityScore.GetTotal().Value,
                            "Ability scores with non-null base bases should have a total equal to their base score by default.");
            Assert.AreEqual(-2, abilityScore.GetModifier(),
                            "Modifier for ability score 6 is -2.");
            Assert.AreEqual(0, abilityScore.GetBonus(),
                            "Bonuses for ability scores below 12 are always zero.");
        }
        public void BaseScoreNineteen_Aggregates()
        {
            // Arrange
            AbilityScore abilityScore = new AbilityScore();

            abilityScore.BaseScore = 19;

            // Assert
            Assert.IsTrue(abilityScore.GetTotal().HasValue,
                          "Ability scores with a non-null base score should always have a total.");
            Assert.AreEqual(19, abilityScore.GetTotal().Value,
                            "Ability scores with non-null base bases should have a total equal to their base score by default.");
            Assert.AreEqual(4, abilityScore.GetModifier(),
                            "Modifier for ability score 19 is 4.");
            Assert.AreEqual(abilityScore.GetModifier(), abilityScore.GetBonus(),
                            "Bonuses for ability scores above 12 are equal to their modifier.");
        }
        public void BigPenalties_Aggregates()
        {
            // Arrange
            AbilityScore abilityScore = new AbilityScore();

            abilityScore.BaseScore = 1;
            abilityScore.Penalties.Add(() => 6);

            // Act
            byte?total = abilityScore.GetTotal();

            // Assert
            Assert.IsTrue(total.HasValue,
                          "An ability score with a non-null base score should have a non-null total.");
            Assert.AreEqual(0, total.Value,
                            "A negative total ability score should be reported as though it was zero.");
            Assert.AreEqual(-5, abilityScore.GetModifier(),
                            "An ability score of 0 should have a -5 modifier.");
            Assert.AreEqual(0, abilityScore.GetBonus(),
                            "An ability score of less than 12 should have a bonus of zero.");
        }
        public void TypicalPenalties_Aggregates()
        {
            // Arrange
            AbilityScore abilityScore = new AbilityScore();

            abilityScore.BaseScore = 10;
            abilityScore.Penalties.Add(() => 6);

            // Act
            byte?total = abilityScore.GetTotal();

            // Assert
            Assert.IsTrue(total.HasValue,
                          "An ability score with a non-null base score should have a non-null total.");
            Assert.AreEqual(4, total.Value,
                            "An ability score of 10 with a penalty of -6 should have a total of 4.");
            Assert.AreEqual(-3, abilityScore.GetModifier(),
                            "An ability score of 4 should have a -3 modifier.");
            Assert.AreEqual(0, abilityScore.GetBonus(),
                            "An ability score of less than 12 should have a bonus of zero.");
        }
        public void MoraleBonuses_Aggregates()
        {
            // Arrange
            AbilityScore abilityScore = new AbilityScore();

            abilityScore.BaseScore = 10;
            abilityScore.MoraleBonuses.Add(() => 6);

            // Act
            byte?total = abilityScore.GetTotal();

            // Assert
            Assert.IsTrue(total.HasValue,
                          "An ability score with a non-null base score should have a non-null total.");
            Assert.AreEqual(16, total.Value,
                            "An ability score of 10 with a morale bonus of +6 should have a total of 16.");
            Assert.AreEqual(3, abilityScore.GetModifier(),
                            "An ability score of 16 should have a +3 modifier.");
            Assert.AreEqual(3, abilityScore.GetBonus(),
                            "An ability score of 16 should have a +3 bonus.");
        }