예제 #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();
        }
예제 #2
0
        public PowerJobTest()
        {
            _powerContext = new Mock <IPowerContext>();
            _power        = new Mock <IPower>(null);

            _jobContextJob = new PowerJobContext();
            _jobTest       = new PowerJob(_power.Object, _powerContext.Object);
        }