public void TurnEngine_DetermineCriticalMissProblem_Attacker_Null_Roll_1_Should_Return_Nothing_Broke() { MockForms.Init(); // Turn off random numbers // Set random to 1, and to hit to 1 GameGlobals.SetForcedRandomNumbersValueAndToHit(1, 1); GameGlobals.SetForcedRandomNumbersValue(1); var myTurnEngine = new TurnEngine(); var myCharacter = new Character(DefaultModels.CharacterDefault()); myCharacter.PrimaryHand = null; // Nothing in the hand, so nothing to drop... var Actual = myTurnEngine.DetermineCriticalMissProblem(myCharacter); // Should roll for 1 item, and return it... var Expected = " Luckly, nothing to drop from PrimaryHand"; // Reset GameGlobals.ToggleRandomState(); Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name); }
public void Character_ScaleLevel_Level_2_Forced_5_Should_Return_MaxHealth_10() { //Health, Attack, Defense, Speed int[] BaseClassBaseStats = { 5, 4, 3, 4 }; int[] MageClassBaseStats = { 4, 7, 3, 4 }; int[] KnightClassBaseStats = { 6, 6, 6, 2 }; int[] AssasinClassBaseStats = { 3, 5, 3, 8 }; // Base stats. int[][] ClassBaseStats = { BaseClassBaseStats, MageClassBaseStats, KnightClassBaseStats, AssasinClassBaseStats }; // Arrange var Test = new Character(); int Level = 2; int Expected = ClassBaseStats[Test.ClassCode()][0] + 5; // Expected MaxHealth // Turn on Forced Values GameGlobals.SetForcedRandomNumbersValue(5); // Act var Actual = Test.ScaleLevel(Level); // Reset GameGlobals.DisableRandomValues(); // Assert Assert.AreEqual(Expected, Test.GetHealthMax(), TestContext.CurrentContext.Test.Name); }
// Debug Switches /// <summary> /// Turn on Random Number Forced Values /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UseForcedRandomValuesSwitch_OnToggled(object sender, ToggledEventArgs e) { if (e.Value) { ForcedRandomValuesSettingsFrame.IsVisible = true; GameGlobals.EnableRandomValues(); GameGlobals.SetForcedRandomNumbersValue(Convert.ToInt16(ForcedValue.Text)); } else { GameGlobals.DisableRandomValues(); ForcedRandomValuesSettingsFrame.IsVisible = false; } }
public void Character_ScaleLevel_Level_2_Forced_5_Should_Return_MaxHealth_10() { // Arrange var Test = new Character(); int Level = 2; int Expected = 10; // Expected MaxHealth // Turn on Forced Values GameGlobals.SetForcedRandomNumbersValue(5); // Act var Actual = Test.ScaleLevel(Level); // Reset GameGlobals.DisableRandomValues(); // Assert Assert.AreEqual(Expected, Test.GetHealthMax(), TestContext.CurrentContext.Test.Name); }
public void TurnEngine_DetermineCriticalMissProblem_Attacker_Null_Should_Return_Invalid() { MockForms.Init(); // Turn off random numbers // Set random to 1, and to hit to 1 GameGlobals.SetForcedRandomNumbersValueAndToHit(1, 1); GameGlobals.SetForcedRandomNumbersValue(1); var myTurnEngine = new TurnEngine(); var Actual = myTurnEngine.DetermineCriticalMissProblem(null); // Should roll for 1 item, and return it... var Expected = " Invalid Character "; // Reset GameGlobals.ToggleRandomState(); Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name); }
public void TurnEngine_GetRandomMonsterItemDrops_1_Roll_Should_Return_List() { MockForms.Init(); // Turn off random numbers // Set random to 1, and to hit to 1 GameGlobals.SetForcedRandomNumbersValueAndToHit(1, 1); GameGlobals.SetForcedRandomNumbersValue(1); var myTurnEngine = new TurnEngine(); var roundCount = 1; var Actual = myTurnEngine.GetRandomMonsterItemDrops(roundCount); // Should roll for 1 item, and return it... var Expected = 1; // Reset GameGlobals.ToggleRandomState(); Assert.AreEqual(Expected, Actual.Count(), TestContext.CurrentContext.Test.Name); }
// The stepper function for Forced Value void ForcedValue_OnStepperValueChanged(object sender, ValueChangedEventArgs e) { ForcedValue.Text = String.Format("{0}", e.NewValue); GameGlobals.SetForcedRandomNumbersValue(Convert.ToInt16(ForcedValue.Text)); }