Esempio n. 1
0
        public void GenerateEnemyTest_ShouldReturn_ExpectedEnemy()
        {
            //Arrange
            Enemy expectedEnemy = new Enemy
            {
                Name   = "Bug",
                Class  = EnemyClassENUM.Backend,
                HP     = 260,
                Armor  = 11,
                Damage = 30,
                CompilerErrorChance = 5,
                RuntimeErrorChance  = 5
            };

            EnemyGeneratorService serviceMocked = Substitute.For <EnemyGeneratorService>();

            string         returnValueName = "Bug";
            EnemyClassENUM returnValueENUM = EnemyClassENUM.Backend;

            serviceMocked.GetRandomName().Returns(returnValueName);
            serviceMocked.GetRandomClass().Returns(returnValueENUM);

            //Act
            Enemy resultEnemy = serviceMocked.GenerateEnemy(_testPlayer).Result;

            //Asserts
            Assert.AreEqual(expectedEnemy.Name, resultEnemy.Name);
            Assert.AreEqual(expectedEnemy.Class, resultEnemy.Class);
            Assert.AreEqual(expectedEnemy.HP, resultEnemy.HP);
            Assert.AreEqual(expectedEnemy.Armor, resultEnemy.Armor);
            Assert.AreEqual(expectedEnemy.Damage, resultEnemy.Damage);
            Assert.AreEqual(expectedEnemy.CompilerErrorChance, resultEnemy.CompilerErrorChance);
            Assert.AreEqual(expectedEnemy.RuntimeErrorChance, resultEnemy.RuntimeErrorChance);
        }
Esempio n. 2
0
        public async Task Setup()
        {
            _character = new Character
            {
                Algorithm      = 3,
                CharacterLevel = 2,
                CleanCode      = 4,
                DebugChance    = 10,
                Design         = 1,
                Energy         = 3,
                FastCoding     = 2,
                Motivation     = 300,
                ProblemSolving = 2,
                Testing        = 1
            };

            _enemy = await _enemyGeneratorService.GenerateEnemy(_character);
        }