Beispiel #1
0
        public void HitStatusEnumHelper_ConvertMessageStringToEnum_Bogus_Should_Fail()
        {
            // Arrange

            // Act
            var result = HitStatusEnumHelper.ConvertMessageStringToEnum("Bogus");

            // Assert
            Assert.AreEqual(HitStatusEnum.Unknown, result);
        }
Beispiel #2
0
        public void HitStatusEnumHelper_ConvertMessageStringToEnum_Valid_Should_Pass()
        {
            // Arrange

            // Act
            var result = HitStatusEnumHelper.ConvertMessageStringToEnum(" misses ");

            // Assert
            Assert.AreEqual(HitStatusEnum.Miss, result);
        }
        public void HitStatusEnumHelperTests_ConvertStringToEnum_Default_Should_Pass()
        {
            // Arrange

            // Act
            var result = HitStatusEnumHelper.ConvertStringToEnum("Default");

            // Reset

            // Assert
            Assert.AreEqual(HitStatusEnum.Default, result);
        }
        public void HitStatusEnumHelperTests_ConvertStringToEnum_CriticalMiss_Should_Pass()
        {
            // Arrange

            // Act
            var result = HitStatusEnumHelper.ConvertStringToEnum("CriticalMiss");

            // Reset

            // Assert
            Assert.AreEqual(HitStatusEnum.CriticalMiss, result);
        }
        public void HitStatusEnumHelperTests_ConvertStringToEnum_Unknown_Should_Pass()
        {
            // Arrange

            // Act
            var result = HitStatusEnumHelper.ConvertStringToEnum("Unknown");

            // Reset

            // Assert
            Assert.AreEqual(HitStatusEnum.Unknown, result);
        }
        public void HitStatusEnumHelperTests_ConvertMessageStringToEnum_misses_really_badly_Should_Pass()
        {
            // Arrange

            // Act
            var result = HitStatusEnumHelper.ConvertMessageStringToEnum(" misses really badly");

            // Reset

            // Assert
            Assert.AreEqual(HitStatusEnum.CriticalMiss, result);
        }
        public void HitStatusEnumHelperTests_ConvertMessageStringToEnum_hits_really_hard_Should_Pass()
        {
            // Arrange

            // Act
            var result = HitStatusEnumHelper.ConvertMessageStringToEnum(" hits really hard ");

            // Reset

            // Assert
            Assert.AreEqual(HitStatusEnum.CriticalHit, result);
        }
        public void HitStatusEnumHelperTests_ConvertMessageStringToEnum_BogusString_Should_Pass()
        {
            // Arrange

            // Act
            var result = HitStatusEnumHelper.ConvertMessageStringToEnum("This doesn't exist");

            // Reset

            // Assert
            Assert.AreEqual(HitStatusEnum.Unknown, result);
        }
Beispiel #9
0
        public void HitStatusEnumHelper_ConvertStringToEnum_Should_Pass()
        {
            // Arrange

            var myList = Enum.GetNames(typeof(HitStatusEnum)).ToList();

            HitStatusEnum myActual;
            HitStatusEnum myExpected;

            // Act

            foreach (var item in myList)
            {
                myActual   = HitStatusEnumHelper.ConvertStringToEnum(item);
                myExpected = (HitStatusEnum)Enum.Parse(typeof(HitStatusEnum), item);

                // Assert
                Assert.AreEqual(myExpected, myActual, "string: " + item + TestContext.CurrentContext.Test.Name);
            }
        }
        /// <summary>
        /// Set the Monster Hit Enum
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public void MonsterHitPicker_Changed(object sender, EventArgs args)
        {
            // Check for null, SelectedItem is not set when the control is created
            if (MonsterHitPicker.SelectedItem == null)
            {
                return;
            }

            // Change the Difficulty
            BattleEngineViewModel.Instance.Engine.EngineSettings.BattleSettingsModel.MonsterHitEnum = HitStatusEnumHelper.ConvertStringToEnum(MonsterHitPicker.SelectedItem.ToString());
        }