Beispiel #1
0
        public void hitDamage()
        {
            HeroTest hero = new HeroTest("johaen");

            int actualResult = hero._hitDamage();

            Assert.IsTrue(actualResult >= 1 && actualResult <= 600);
            //Arrange

            //Act

            //Assert
        }
Beispiel #2
0
        public void generateAbilitiesTestMethod()
        {
            HeroTest hero = new HeroTest("johaen");

            bool expectedResult = true;
            bool actualResult   = hero._generateAbilities();

            Assert.AreEqual(expectedResult, actualResult);

            /*hero.Fight();
             * hero.Show();
             *
             * //Arrange
             * int _strength;
             * int _speed;
             * int _health;
             * int expectedResult;
             * //Act
             *
             * //Assert*/
        }
        private void SetOrValidateHeroVars(Hero h, bool store)
        {
            var gender      = h.IsFemale ? "F" : "M";
            var fellowClans = h.Clan?.Kingdom?.Clans.Where(c => c != h.Clan).OrderBy(c => c.Name.ToString()).ToArray();
            var ht          = new HeroTest(h);

            if (store)
            {
                h.SetVariable("Gender", gender);
                h.SetVariable("FellowClans", fellowClans);
                h.SetVariable("HeroTest", ht);

                if (h.TryGetVariable("HeroTest", out HeroTest? ht2) && ht2 != ht)
                {
                    Error("Set != Get: HeroTest");
                }

                if (h.TryGetVariable("Gender", out string gender2) && gender2 != gender)
                {
                    Error("Set != Get: Gender");
                }

                if (h.TryGetVariable("FellowClans", out Clan[]? fellowClans2) && fellowClans2 != fellowClans)