public void PlateKitAugmentClothFails() { OutputHelper.Display.ClearUserOutput(); _armorKit = new ArmorKit(KitLevel.Light, ArmorKit.ArmorKitType.Plate); int baseArmorItemValue = _armor.ItemValue; int baseArmorRating = _armor.ArmorRating; string displayMessage = $"You can't upgrade {_textInfo.ToTitleCase(_armor.Name)} with that!"; _armorKit.AttemptAugmentArmorPlayer(_armor); Assert.AreEqual(displayMessage, OutputHelper.Display.Output[0][2]); Assert.AreEqual(false, _armorKit.KitHasBeenUsed); Assert.AreEqual(baseArmorItemValue, _armor.ItemValue); Assert.AreEqual(baseArmorRating, _armor.ArmorRating); }
public void LeatherKitAugmentLeatherSucceeds() { OutputHelper.Display.ClearUserOutput(); _armorKit = new ArmorKit(KitLevel.Light, ArmorKit.ArmorKitType.Leather); _armor = new Armor(3, ArmorType.Leather, ArmorSlot.Chest); int baseArmorItemValue = _armor.ItemValue; int baseArmorRating = _armor.ArmorRating; string displayMessage = $"You upgraded {_textInfo.ToTitleCase(_armor.Name)} with an armor kit."; _armorKit.AttemptAugmentArmorPlayer(_armor); Assert.AreEqual(displayMessage, OutputHelper.Display.Output[0][2]); Assert.AreEqual(true, _armorKit.KitHasBeenUsed); Assert.AreEqual(baseArmorItemValue + _armorKit.ItemValue, _armor.ItemValue); Assert.AreEqual(baseArmorRating + _armorKit.KitAugmentAmount, _armor.ArmorRating); }
public void ArmorUpgradeKitUnitTest() { Player player = new Player("test", PlayerClassType.Mage); player.Inventory.Add(new ArmorKit(KitLevel.Light, ArmorKit.ArmorKitType.Cloth)); GearHelper.EquipInitialGear(player); OutputHelper.Display.ClearUserOutput(); int armorIndex = player.Inventory.FindIndex(f => f.Name.Contains("cloth")); Armor armor = player.Inventory[armorIndex] as Armor; TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; string armorName = textInfo.ToTitleCase(player.Inventory[armorIndex].Name); ArmorKit armorKit = player.Inventory.Find(item => item is ArmorKit) as ArmorKit; int kitAmount = armorKit.KitAugmentAmount; string kitName = armorKit.Name; string[] input = new[] { "enhance", "doesn't exist", kitName }; int armorAmount = armor.ArmorRating; GearHelper.UseArmorKit(player, input); const string upgradeFail = "What armor did you want to upgrade?"; Assert.AreEqual(upgradeFail, OutputHelper.Display.Output[0][2]); Assert.IsNotEmpty(player.Inventory); input = new[] { "enhance", armorName, "doesn't exist" }; GearHelper.UseArmorKit(player, input); const string kitFail = "What armor kit did you want to use?"; Assert.AreEqual(kitFail, OutputHelper.Display.Output[1][2]); Assert.IsNotEmpty(player.Inventory); input = new[] { "enhance", armorName, kitName }; GearHelper.UseArmorKit(player, input); string upgradeSuccess = $"You upgraded {armorName} with an armor kit."; Assert.AreEqual(upgradeSuccess, OutputHelper.Display.Output[2][2]); Assert.AreEqual(armorAmount + kitAmount, armor.ArmorRating); Assert.AreEqual(0, player.Inventory.FindAll(item => item is IKit).Count); player.Inventory.Add(new ArmorKit(KitLevel.Light, ArmorKit.ArmorKitType.Leather)); kitName = player.Inventory.Find(item => item is ArmorKit).Name; input = new[] { "enhance", armorName, kitName }; GearHelper.UseArmorKit(player, input); string enhanceFail = $"You can't upgrade {armorName} with that!"; Assert.IsNotEmpty(player.Inventory); Assert.AreEqual(enhanceFail, OutputHelper.Display.Output[3][2]); }
public void HeavyKitCreationTest() { _armorKit = new ArmorKit(KitLevel.Heavy, ArmorKit.ArmorKitType.Cloth); Assert.AreEqual(3, _armorKit.KitAugmentAmount); }
public void MediumKitCreationTest() { _armorKit = new ArmorKit(KitLevel.Medium, ArmorKit.ArmorKitType.Cloth); Assert.AreEqual(2, _armorKit.KitAugmentAmount); }
public void Setup() { _armorKit = new ArmorKit(KitLevel.Light, ArmorKit.ArmorKitType.Cloth); _armor = new Armor(3, ArmorType.Cloth, ArmorSlot.Chest); }
public static void UseArmorKit(Player player, string[] userInput) { int kitIndex = player.Inventory.FindIndex(f => f.Name.Contains(userInput[2])); if (kitIndex == -1) { OutputHelper.Display.StoreUserOutput( Settings.FormatFailureOutputText(), Settings.FormatDefaultBackground(), "What armor kit did you want to use?"); return; } int armorIndex = player.Inventory.FindIndex(f => f.Name.Contains(userInput[1].ToLower())); if (armorIndex == -1) { OutputHelper.Display.StoreUserOutput( Settings.FormatFailureOutputText(), Settings.FormatDefaultBackground(), "What armor did you want to upgrade?"); return; } Armor armor = player.Inventory[armorIndex] as Armor; TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; string armorName = textInfo.ToTitleCase(armor.Name); if (!armor.Equipped) { bool inputValid = false; while (!inputValid) { string armorString = $"{armorName} is not equipped. Are you sure you want to upgrade that?"; OutputHelper.Display.StoreUserOutput( Settings.FormatFailureOutputText(), Settings.FormatDefaultBackground(), armorString); OutputHelper.Display.BuildUserOutput(); OutputHelper.Display.ClearUserOutput(); string[] input = InputHelper.GetFormattedInput(Console.ReadLine()); if (input[0] == "no" || input[0] == "n") { return; } if (input[0] == "yes" || input[0] == "y") { inputValid = true; } } } ArmorKit armorKit = player.Inventory[kitIndex] as ArmorKit; armorKit.AttemptAugmentArmorPlayer(armor); if (armorKit.KitHasBeenUsed) { player.Inventory.RemoveAt(kitIndex); } }