示例#1
0
        public void PiterMethodBuild_ExceptionThrow(int leftBorder, int rightBorder)
        {
            //Arrange

            //Act
            PiterMethod piterMethod = PiterMethod.PiterMethodInitialize(leftBorder, rightBorder);

            //Assert
        }
示例#2
0
        public void PiterMethodCalculatingCaunt(int leftBorder, int rightBorder, int expectedCount)
        {
            //Arrange
            int count = 0;
            //Act
            PiterMethod piterMethod = PiterMethod.PiterMethodInitialize(leftBorder, rightBorder);

            foreach (Ticket t in piterMethod.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();
            }
        }