public void DoesNotRead_CustomCraftRate_When_CraftingTakesNoTime() { string priceLabel = "irrelevant"; string[] priceOptions = new[] { String.Empty, String.Empty, String.Empty }; int initialMagicCraftRate = -10000000; int initialMundaneCraftRate = 9348458; bool initialCustomCraftRate = true; //control Settings settings = new Settings { MagicCraftingRate = initialMagicCraftRate, MundaneCraftingRate = initialMundaneCraftRate, CustomCraftRate = initialCustomCraftRate, }; Mock <ICheatSectionRenderer> renderer = new Mock <ICheatSectionRenderer>(); renderer.Setup(r => r.Evaluate_CraftingTakesNoTime(It.IsAny <bool>())).Returns(true); //invocation UserInterfaceEventHandlingLogic.RenderCheatsSectionAndUpdateSettings(renderer.Object, settings, priceLabel, priceOptions); //validation Assert.AreEqual(initialMagicCraftRate, settings.MagicCraftingRate); Assert.AreEqual(initialMundaneCraftRate, settings.MundaneCraftingRate); Assert.AreEqual(initialCustomCraftRate, settings.CustomCraftRate); }
public void Reads_CustomCraftRate() { string priceLabel = "irrelevant"; string[] priceOptions = new[] { String.Empty, String.Empty, String.Empty }; /************ * Test 1 * ************/ //control Settings settings = new Settings { CustomCraftRate = false }; Mock <ICheatSectionRenderer> renderer = new Mock <ICheatSectionRenderer>(); renderer.Setup(r => r.Evaluate_CraftingTakesNoTime(It.IsAny <bool>())).Returns(false); renderer.Setup(r => r.Evaluate_CustomCraftRate(It.IsAny <bool>())).Returns(true); //invocation UserInterfaceEventHandlingLogic.RenderCheatsSectionAndUpdateSettings(renderer.Object, settings, priceLabel, priceOptions); //validation Assert.AreEqual(true, settings.CustomCraftRate); /************ * Test 2 * ************/ //control settings = new Settings { CustomCraftRate = true }; renderer = new Mock <ICheatSectionRenderer>(); renderer.Setup(r => r.Evaluate_CraftingTakesNoTime(It.IsAny <bool>())).Returns(false); renderer.Setup(r => r.Evaluate_CustomCraftRate(It.IsAny <bool>())).Returns(false); //invocation UserInterfaceEventHandlingLogic.RenderCheatsSectionAndUpdateSettings(renderer.Object, settings, priceLabel, priceOptions); //validation Assert.AreEqual(false, settings.CustomCraftRate); }
public void Reads_CraftingPriceScale_From_CraftingCostSelection() { string priceLabel = "irrelevant"; string[] priceOptions = new[] { String.Empty, String.Empty, String.Empty }; /************ * Test 1 * ************/ //control Settings settings = new Settings { CraftingPriceScale = -4 }; Mock <ICheatSectionRenderer> renderer = new Mock <ICheatSectionRenderer>(); renderer.Setup(r => r.Evaluate_CraftingCostsNoGold(It.IsAny <bool>())).Returns(false); renderer.Setup(r => r.Evaluate_CraftingCostSelection(It.IsAny <string>(), It.IsAny <string[]>())).Returns(1); //invocation UserInterfaceEventHandlingLogic.RenderCheatsSectionAndUpdateSettings(renderer.Object, settings, priceLabel, priceOptions); //validation Assert.AreEqual(2, settings.CraftingPriceScale); /************ * Test 2 * ************/ //control settings = new Settings { CraftingPriceScale = -4 }; renderer = new Mock <ICheatSectionRenderer>(); renderer.Setup(r => r.Evaluate_CraftingCostsNoGold(It.IsAny <bool>())).Returns(false); renderer.Setup(r => r.Evaluate_CraftingCostSelection(It.IsAny <string>(), It.IsAny <string[]>())).Returns(0); //invocation UserInterfaceEventHandlingLogic.RenderCheatsSectionAndUpdateSettings(renderer.Object, settings, priceLabel, priceOptions); //validation Assert.AreEqual(1, settings.CraftingPriceScale); }
public void DoesNotInvoke_WarningAboutCustomItemVanillaItemCostDisparity_When_CraftingCostsNoGold() { string priceLabel = "irrelevant"; string[] priceOptions = new[] { String.Empty, String.Empty, String.Empty }; //control bool invokedWarning = false; Action setInvoked = () => { invokedWarning = true; }; Mock <ICheatSectionRenderer> renderer = new Mock <ICheatSectionRenderer>(); renderer.Setup(r => r.Evaluate_CraftingCostsNoGold(It.IsAny <bool>())).Returns(true); renderer.Setup(r => r.RenderOnly_WarningAboutCustomItemVanillaItemCostDisparity()).Callback(setInvoked); //invocation UserInterfaceEventHandlingLogic.RenderCheatsSectionAndUpdateSettings(renderer.Object, new Settings(), priceLabel, priceOptions); //validation Assert.AreEqual(false, invokedWarning); }
public void Defaults_MundaneCraftingRate() { string priceLabel = "irrelevant"; string[] priceOptions = new[] { String.Empty, String.Empty, String.Empty }; //control Settings settings = new Settings { MundaneCraftingRate = -23412345 }; Mock <ICheatSectionRenderer> renderer = new Mock <ICheatSectionRenderer>(); renderer.Setup(r => r.Evaluate_CraftingTakesNoTime(It.IsAny <bool>())).Returns(false); renderer.Setup(r => r.Evaluate_CustomCraftRate(It.IsAny <bool>())).Returns(false); //invocation UserInterfaceEventHandlingLogic.RenderCheatsSectionAndUpdateSettings(renderer.Object, settings, priceLabel, priceOptions); //validation Assert.AreEqual(Settings.MundaneCraftingProgressPerDay, settings.MundaneCraftingRate); }
public void Reads_CraftingCostSelection() { string priceLabel = "irrelevant"; string[] priceOptions = new[] { String.Empty, String.Empty, String.Empty }; //control bool invokedWarning = false; Action setInvoked = () => { invokedWarning = true; }; Mock <ICheatSectionRenderer> renderer = new Mock <ICheatSectionRenderer>(); renderer.Setup(r => r.Evaluate_CraftingCostsNoGold(It.IsAny <bool>())).Returns(false); renderer.Setup(r => r.Evaluate_CraftingCostSelection(It.IsAny <string>(), It.IsAny <string[]>())).Callback(setInvoked); //invocation UserInterfaceEventHandlingLogic.RenderCheatsSectionAndUpdateSettings(renderer.Object, new Settings(), priceLabel, priceOptions); //validation Assert.AreEqual(true, invokedWarning); }
public void DoesNotRead_CraftingPriceScale_When_CraftingCostsNoGold() { string priceLabel = "irrelevant"; string[] priceOptions = new[] { String.Empty, String.Empty, String.Empty }; int initial = -10000000; //control Settings settings = new Settings { CraftingPriceScale = initial, }; Mock <ICheatSectionRenderer> renderer = new Mock <ICheatSectionRenderer>(); renderer.Setup(r => r.Evaluate_CraftingCostsNoGold(It.IsAny <bool>())).Returns(true); //invocation UserInterfaceEventHandlingLogic.RenderCheatsSectionAndUpdateSettings(renderer.Object, settings, priceLabel, priceOptions); //validation Assert.AreEqual(initial, settings.CraftingPriceScale); }