Esempio n. 1
0
        private static void Resolve(IPower power, string heroi)
        {
            PowerContext    context    = new PowerContext();
            PowerJobContext contextJob = new PowerJobContext();
            PowerJob        job        = new PowerJob(power, context);

            contextJob.SuperHero = heroi;

            var result = job.GetPower(contextJob);

            if (result.IsSuccess)
            {
                Console.WriteLine($"Herói: {result.Success.NameHero}");
                Console.WriteLine($"Poder: {result.Success.Name}");
                Console.WriteLine($"Dano: {result.Success.Damage}");
            }
            else
            {
                Console.WriteLine($"Herói: {heroi }");
                Console.WriteLine($"Error: {result.Error.Msg }");
            }

            Console.WriteLine();
            Console.WriteLine("// ------------------------ //");
            Console.WriteLine();
        }
Esempio n. 2
0
        public void GetPower_ExistSuperHero_Success()
        {
            //Arrange
            string superHero = "Flash";

            _jobContextJob.SuperHero = superHero;

            _powerContext.Setup(s => s.Create(_jobContextJob.SuperHero));
            _power.Setup(s => s.GetPower(_powerContext.Object)).Returns(new Power(superHero, "Speed", 700));

            //Act
            var result = _jobTest.GetPower(_jobContextJob);

            //Assert

            Assert.IsTrue(result.IsSuccess);
            Assert.AreEqual(result.Success.NameHero, superHero);
        }