public void ChangePriceofTicket_should_AddNewPriceOfTicket()
        {
            //arrange

            var football = new FootballStadiumService(new XMLProvider <FootballStadium>("footballl.xml"));

            football.AddPriceofTicket(1);
            double price    = 10;
            int    index    = 0;
            double expected = 10;

            //act
            football.ChangePriceofTicket(index, price);
            //assert
            Assert.Equal(expected, football[index].PriceOfTicket);
        }
Esempio n. 2
0
        public void PriceOfofTicket()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine("Price\n1. Add price of ticket\n2. Change price of ticket\n0.  Back");
                Console.Write("Action: ");
                string choise = Console.ReadLine();
                Console.Clear();
                switch (choise)
                {
                case "0":
                    return;

                case "1":
                    try
                    {
                        Console.WriteLine("Price < 100");
                        Console.Write("Add price of ticket: ");
                        var rpice = validator.validator_priceofTicket(Console.ReadLine());
                        Fts.AddPriceofTicket(Convert.ToDouble(rpice));
                    }
                    catch (Exception e) { Console.WriteLine(e.Message); Console.ReadKey(); }
                    break;

                case "2":
                    try
                    {
                        Console.WriteLine("Price < 100");
                        Console.WriteLine("Change price if ticket");
                        int ind = IndexFootball();
                        Console.Write("New price: ");
                        var price = validator.validator_priceofTicket(Console.ReadLine());

                        Fts.ChangePriceofTicket(ind, Convert.ToDouble(price));
                    }
                    catch (Exception e) { Console.WriteLine(e.Message); Console.ReadKey(); }
                    break;

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