예제 #1
0
        public void MoscowMethod_ExceptionThrow(int leftBorder, int rightBorder)
        {
            //Arrange

            //Act
            MoscowMethod moscowMethod = MoscowMethod.MoscovMethodInitialize(leftBorder, rightBorder);

            //Assert
        }
예제 #2
0
        public void MoscowMethodCalculatingCaunt(int leftBorder, int rightBorder, int expectedCount)
        {
            //Arrange
            int count = 0;
            //Act
            MoscowMethod moscowMethod = MoscowMethod.MoscovMethodInitialize(leftBorder, rightBorder);

            foreach (Ticket t in moscowMethod.GetTickets())
            {
                count++;
            }
            //Assert
            Assert.AreEqual(count, expectedCount);
        }
예제 #3
0
        public static void CallMenu()
        {
            const int RIGHT_COUNT_OF_ARGS = 2;

            string[] args = Environment.GetCommandLineArgs();
            Instruction();
            try
            {
                switch (args.Length)
                {
                case RIGHT_COUNT_OF_ARGS:
                {
                    Console.WriteLine("Please input left border:");
                    int.TryParse(Console.ReadLine(), out int leftborder);
                    Console.WriteLine("Please input right border:");
                    int.TryParse(Console.ReadLine(), out int rightborder);
                    HappyTickets h;
                    if (ReadFile(args[1]) == "Piter")
                    {
                        h = PiterMethod.PiterMethodInitialize(leftborder, rightborder);
                        Console.WriteLine(h.CountOfHappyTicket);
                    }
                    if (ReadFile(args[1]) == "Moskow")
                    {
                        h = MoscowMethod.MoscovMethodInitialize(leftborder, rightborder);
                        Console.WriteLine(h.CountOfHappyTicket);
                    }
                    Console.ReadLine();
                    break;
                }

                default:
                {
                    Instruction();
                    break;
                }
                }
            }
            catch (Exception)
            {
                Instruction();
            }
        }