public void EqualsComparison_Test_Null(string dmgId1, string amrId1, bool expected) { Damage dmgType1 = new Damage(dmgId1); Armour amrType1 = new Armour(amrId1); DamageToArmour dmgtoA1 = new DamageToArmour(dmgType1, amrType1); Assert.AreEqual(expected, dmgtoA1.Equals(null)); }
public void EqualsComparison_Test(string dmgId1, string dmgId2, string amrId1, string armId2, bool expected) { Damage dmgType1 = new Damage(dmgId1); Damage dmgType2 = new Damage(dmgId2); Armour amrType1 = new Armour(amrId1); Armour amrType2 = new Armour(armId2); DamageToArmour dmgtoA1 = new DamageToArmour(dmgType1, amrType1); DamageToArmour dmgtoA2 = new DamageToArmour(dmgType2, amrType2); Assert.AreEqual(expected, dmgtoA1.Equals(dmgtoA2)); }
private static void ParseAndUpdateDamageToArmourMatrix(string gameConstantsFilePath) { Debug.Assert(gameConstantsFilePath != null, nameof(gameConstantsFilePath) + " != null"); Debug.Assert(File.Exists(gameConstantsFilePath), nameof(gameConstantsFilePath) + " must exist"); XDocument gameConstantsFile = XDocument.Load(gameConstantsFilePath); Debug.Assert(gameConstantsFile.Root != null, "gameConstantsFile.Root != null"); foreach (XElement xElement in gameConstantsFile.Root.Elements()) { if (!xElement.Name.ToString().Equals(Tags.DAMAGE_TO_ARMOR_MOD, StringComparison.InvariantCultureIgnoreCase)) { continue; } DamageToArmour dta = DamageToArmourUtility.ParseFromString(xElement.Value); DamageToArmour dtaToUpdate = DamageToArmourUtility.Get(dta.Damage, dta.Armour); Debug.Assert(dtaToUpdate != null, nameof(dtaToUpdate) + " != null"); dtaToUpdate.DamageToArmourFactor = dta.DamageToArmourFactor; } }