public void AddRHealth_should_AddHealth()
        {
            Player player   = new Player();
            var    pl       = new PlayerService(new XMLProvider <Player>("player.xml"));
            string health   = "health";
            var    expected = player.Health = "health";

            //act
            pl.AddHealth(health);
            //assert
            Assert.Equal(expected, player.Health);
        }
        public void ChangeHealth_should_AddNewHealth()
        {
            //arrange

            var pl = new PlayerService(new XMLProvider <Player>("player.xml"));

            pl.AddHealth("health");
            string health   = "health";
            int    index    = 0;
            var    expected = "health";

            //act
            pl.ChangeRole(health, index);
            //assert
            Assert.Equal(expected, pl[index].Health);
        }
        public void ChangeSalary_should_AddNewHealth()
        {
            //arrange

            var pl = new PlayerService(new XMLProvider <Player>("player.xml"));

            pl.AddHealth("health");
            int sal      = 10;
            int index    = 0;
            var expected = 10;

            //act
            pl.ChangeSalery(sal, index);
            //assert
            Assert.Equal(expected, pl[index].Salary);
        }
Example #4
0
        public void Health()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine("Heatlth\n1. Add health of player\n2. Change health of birthday of player\n0.  Back");
                Console.Write("Action: ");
                string choise = Console.ReadLine();
                Console.Clear();
                switch (choise)
                {
                case "0":
                    return;

                case "1":
                    try
                    {
                        Console.WriteLine("Add health of birthday(good/bad....) : ");
                        string health = validator.validator_name(Console.ReadLine());
                        pls.AddHealth(health);
                    }
                    catch (Exception e) { Console.WriteLine(e.Message); Console.ReadKey(); }
                    break;

                case "2":
                    try
                    {
                        Console.Write("Change health of player: ");
                        var index = IndexPlayer();
                        Console.WriteLine("Add new health of player");
                        string health = validator.validator_name(Console.ReadLine());
                        pls.ChangeHealth(health, index);
                    }
                    catch (Exception e) { Console.WriteLine(e.Message); Console.ReadKey(); }
                    break;

                default:
                    Console.WriteLine("Wrong index\nPress any key to continue...");
                    Console.ReadKey();
                    break;
                }
            }
        }