public void AddBday_should_return_NewBday()
        {
            //arrange
            Player player   = new Player();
            var    pl       = new PlayerService(new XMLProvider <Player>("player.xml"));
            var    day      = 10;
            var    expected = player.BDay = 10;

            //act
            pl.AddBDay(day);
            //assert
            Assert.Equal(expected, player.BDay);
        }
        public void ChangeRole_should_AddNewRole()
        {
            //arrange

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

            pl.AddBDay(10);
            string roley    = "role";
            int    index    = 0;
            var    expected = "role";

            //act
            pl.ChangeRole(roley, index);
            //assert
            Assert.Equal(expected, pl[index].Role);
        }
        public void ChangeBday_should_return_NewBday()
        {
            //arrange

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

            pl.AddBDay(10);
            int day      = 10;
            int index    = 0;
            var expected = 10;

            //act
            pl.ChangeBDay(day, index);
            //assert
            Assert.Equal(expected, pl[index].BDay);
        }
Example #4
0
        public void BDay()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine("BDay\n1. Add day of birthday of player\n2. Change day 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 day of birthday");
                        var day = validator.validator_day(Console.ReadLine());
                        pls.AddBDay(Convert.ToInt32(day));
                    }
                    catch (Exception e) { Console.WriteLine(e.Message); Console.ReadKey(); }
                    break;

                case "2":
                    try
                    {
                        Console.Write("Change BDay of player: ");
                        var index = IndexPlayer();
                        Console.WriteLine("Add new BDay of player");
                        var day = validator.validator_day(Console.ReadLine());
                        pls.ChangeBDay(Convert.ToInt32(day), index);
                    }
                    catch (Exception e) { Console.WriteLine(e.Message); Console.ReadKey(); }
                    break;

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