100% test coverage baybee

This commit is contained in:
Malachy Byrne 2024-06-14 23:43:42 +01:00
parent 5eadaa67fa
commit 7e0ddceb2c
Signed by: malmal200
GPG Key ID: EC21443030A655D9
3 changed files with 41 additions and 3 deletions

View File

@ -0,0 +1,38 @@
using System.Collections.Generic;
using NUnit.Framework;
using pflib_net.characters.internals.proficiencies;
namespace pflib_net.Tests.characters.internals.proficiencies;
[TestFixture]
[TestOf(typeof(ArmorProficiency))]
public class ArmorProficiencyTest
{
private Dictionary<ProficiencyType, int> _values = new()
{
{ ProficiencyType.Unarmored, 0},
{ ProficiencyType.LightArmor, 5 },
{ ProficiencyType.MediumArmor, 7 },
{ ProficiencyType.HeavyArmor, 9 }
};
private Dictionary<ProficiencyType, ProficiencyValue> _proficiencyValues =
new()
{
{ ProficiencyType.Unarmored, ProficiencyValue.None },
{ ProficiencyType.LightArmor, ProficiencyValue.Trained },
{ ProficiencyType.MediumArmor, ProficiencyValue.Expert },
{ ProficiencyType.HeavyArmor, ProficiencyValue.Master }
};
[Test]
[TestCase(ProficiencyType.Unarmored)]
[TestCase(ProficiencyType.LightArmor)]
[TestCase(ProficiencyType.MediumArmor)]
[TestCase(ProficiencyType.HeavyArmor)]
public void GetValueReturnsCorrectAc(ProficiencyType type)
{
var armorProficiency = new ArmorProficiency(_proficiencyValues);
Assert.That(armorProficiency.GetValue(type, 3), Is.EqualTo(_values[type]));
}
}

View File

@ -10,8 +10,8 @@ public class PlayerCharacter : ICharacter
private int Hp { get; set; } private int Hp { get; set; }
private Stats Stats { get; set; } private Stats Stats { get; set; }
private int Level { get; set; } private int Level { get; set; }
private ArmorProficiency ArmorProficiency { get; set; } private ArmorProficiency ArmorProficiency { get; }
private HashSet<ICondition> Conditions { get; set; } = new HashSet<ICondition>(); private HashSet<ICondition> _conditions = new();
public PlayerCharacter(int hp, Stats stats, int level, ArmorProficiency armorProficiency) public PlayerCharacter(int hp, Stats stats, int level, ArmorProficiency armorProficiency)
{ {

View File

@ -4,7 +4,7 @@ namespace pflib_net.characters.internals.stats;
public class Stats public class Stats
{ {
private Dictionary<StatType, int> StatDict { get; set; } = new(); private Dictionary<StatType, int> StatDict { get; } = new();
public Stats(int strength, int dexterity, int constitution, int intelligence, int wisdom, int charisma) public Stats(int strength, int dexterity, int constitution, int intelligence, int wisdom, int charisma)
{ {