Exemple #1
0
        public void WeaponRetrieveTest()
        {
            // Arrange
            var combatSkillRepository   = new CombatSkillRepository();
            var itemQualitiesRepository = new ItemQualitiesRepository();
            var expectedWeapon          = new Weapon(1)
            {
                Name           = "Baster Pistol",
                BaseDamage     = 3,
                CriticalRating = 4,
                Description    = "Fires blaster bolts",
                Encumbrance    = 2,
                HardPoints     = 2,
                Price          = 400,
                Range          = 2,
                Rarity         = 3,
                Skill          = combatSkillRepository.Retrieve(1),
                Special        = itemQualitiesRepository.Retrieve()
            };
            // Act
            var actualWeaponRepository = new WeaponRepository();
            var actualWeapon           = actualWeaponRepository.Retrieve(1);

            // Assert
            Assert.AreEqual(expectedWeapon.Name, actualWeapon.Name);
            Assert.AreEqual(expectedWeapon.BaseDamage, actualWeapon.BaseDamage);
            Assert.AreEqual(expectedWeapon.CriticalRating, actualWeapon.CriticalRating);
            Assert.AreEqual(expectedWeapon.Description, actualWeapon.Description);
            Assert.AreEqual(expectedWeapon.Encumbrance, actualWeapon.Encumbrance);
            Assert.AreEqual(expectedWeapon.HardPoints, actualWeapon.HardPoints);
            Assert.AreEqual(expectedWeapon.Price, actualWeapon.Price);
            Assert.AreEqual(expectedWeapon.Range, actualWeapon.Range);
            Assert.AreEqual(expectedWeapon.Rarity, actualWeapon.Rarity);
            Assert.AreEqual(expectedWeapon.Skill.Description, actualWeapon.Skill.Description);
            Assert.AreEqual(expectedWeapon.Skill.SkillName, actualWeapon.Skill.SkillName);
            Assert.AreEqual(expectedWeapon.Skill.SkillAbility.AbilityName, actualWeapon.Skill.SkillAbility.AbilityName);
            Assert.AreEqual(expectedWeapon.Skill.SkillAbility.Description, actualWeapon.Skill.SkillAbility.Description);

            for (int i = 0; i < expectedWeapon.Special.Count; i++)
            {
                Assert.AreEqual(expectedWeapon.Special[i].Description, actualWeapon.Special[i].Description);
                Assert.AreEqual(expectedWeapon.Special[i].Passive, actualWeapon.Special[i].Passive);
                Assert.AreEqual(expectedWeapon.Special[i].QualityName, actualWeapon.Special[i].QualityName);
            }
        }