Ejemplo n.º 1
0
        public void AddPlaceofGame_should_AddPlaceofGame()
        {
            //arrange
            Games  games    = new Games();
            var    gam      = new GamesService(new XMLProvider <Games>("games.xml"));
            string city     = "Kiev";
            var    expected = games.CityOfGame = "Kiev";

            //act
            gam.AddPlaceofGame(city);
            //assert
            Assert.Equal(expected, games.CityOfGame);
        }
Ejemplo n.º 2
0
        public void ChangePlaceofGame_should_AddNewPlaceofGameforIndex()
        {
            //arrange

            var gam = new GamesService(new XMLProvider <Games>("games.xml"));

            gam.AddPlaceofGame("Kiev");
            string city     = "Kiev";
            int    index    = 0;
            var    expected = "Kiev";

            //act
            gam.ChangePlaceOfGame(city, index);
            //assert
            Assert.Equal(expected, gam[index].CityOfGame);
        }
Ejemplo n.º 3
0
        public void CityoftheGame()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine("City\n1. Add place of the game\n2. Change placce of the game\n0.  Back");
                Console.Write("Action: ");
                string choise = Console.ReadLine();
                Console.Clear();
                switch (choise)
                {
                case "0":
                    return;

                case "1":
                    try
                    {
                        Console.Write("Add city of the game: ");
                        string city = validator.validator_name(Console.ReadLine());
                        ges.AddPlaceofGame(city);
                    }
                    catch (Exception e) { Console.WriteLine(e.Message); Console.ReadKey(); }
                    break;

                case "2":
                    try
                    {
                        Console.WriteLine("Change place of game");
                        int index = IndexGames();
                        Console.WriteLine("Add new city of game");
                        string city = validator.validator_name(Console.ReadLine());
                        ges.ChangePlaceOfGame(city, index);
                    }
                    catch (Exception e) { Console.WriteLine(e.Message); Console.ReadKey(); }
                    break;

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