/// <summary> /// Adds all afflictions to the Applied Status Effects; /// </summary> /// <param name="affliction">The Afflictions that are applied</param> internal void AddAfflictions(List <ICauseAfflictions> afflictions) { foreach (ICauseAfflictions affliction in afflictions) { AppliedEffects.Add(StatusFab.createStatus(affliction)); } }
public void afflictionToStatusConversion() { StatusFactory statusFab = new StatusFactory(); Dictionary <ICauseAfflictions, IStatusEffect> testCases = new Dictionary <ICauseAfflictions, IStatusEffect>(); CauseBleed bleedAffliction = new CauseBleed(); testCases.Add(bleedAffliction, new Bleed(bleedAffliction)); CauseBreakBones breakBonesAffliction = new CauseBreakBones(); testCases.Add(breakBonesAffliction, new BrokenBone(breakBonesAffliction)); CauseUnconsciousness unconsciousnessAffliction = new CauseUnconsciousness(); testCases.Add(unconsciousnessAffliction, new Unconsciousness(unconsciousnessAffliction)); bool allConvertedCorrect = true; foreach (ICauseAfflictions testAffliction in testCases.Keys) { TestContext.Write("Affliction {0}: ", testAffliction.getAfflictionType()); string constrTypeString = testCases[testAffliction].ToString(); string factTypeString = statusFab.createStatus(testAffliction).ToString(); bool hashCodesAreEqual = constrTypeString == factTypeString; TestContext.WriteLine("Constr.: {0}, Fact.: {1}, Equal: {2}", constrTypeString, factTypeString, hashCodesAreEqual); if (!hashCodesAreEqual) { allConvertedCorrect = false; } } Assert.True(allConvertedCorrect); }