Exemplo n.º 1
0
        public IActionResult Attack(string mass, string opponentEgo)
        {
            string result         = "";
            int    massInt        = 0;
            int    opponentEgoInt = 0;
            //S
            bool massParseSuccess = int.TryParse(mass, out massInt);
            bool egoParseSuccess  = int.TryParse(opponentEgo, out opponentEgoInt);

            if (massParseSuccess && egoParseSuccess)
            {
                int attackDamage = StatCalculator.Attack(massInt, opponentEgoInt);
                //Ha haaaaaa nice pat
                result = $"You did {attackDamage} damage. ALL ROIGHT";
            }
            else if (massParseSuccess && !egoParseSuccess)
            {
                result = "Ego was not in correct format";
            }
            else if (!massParseSuccess && egoParseSuccess)
            {
                result = "Mass was not in correct format";
            }
            else
            {
                result = "Both mass and ego were not in correct format";
            }


            return(Content(result));
        }
Exemplo n.º 2
0
        public void AttackTest(int mass, int opponentEgo, int expected)
        {
            int actual = StatCalculator.Attack(mass, opponentEgo);

            Assert.Equal(expected, actual);
        }