コード例 #1
0
        /// <summary>
        /// Вход в программу
        /// </summary>
        public static void Main(string[] args)
        {
            while (true)
            {
                Console.WriteLine("Creating two lists:");
                Console.WriteLine();

                PersonList list1 = RandomPerson.GetRandomPersonList(3);

                PersonList list2 = RandomPerson.GetRandomPersonList(3);

                Print("list1", list1);

                Print("list2", list2);

                PressAnyKey();

                Console.WriteLine("Add a new person to the first list.");
                Console.WriteLine();

                list1.Add(InputPerson());

                Console.WriteLine("Copy the second person from the " +
                                  "first list to the end of the second list.");
                Console.WriteLine();

                list2.Add(list1[1]);

                Print("list1", list1);

                Print("list2", list2);

                PressAnyKey();

                Console.WriteLine("Removing the second person from the first list.");
                Console.WriteLine();

                list1.Delete(1);

                Print("list1", list1);

                Print("list2", list2);

                PressAnyKey();

                Console.WriteLine("Removing the second list.");
                Console.WriteLine();

                list2.AllDelete();

                Print("list1", list1);

                Print("list2", list2);

                if (QuitOfProgram())
                {
                    return;
                }
            }
        }
コード例 #2
0
        public void Default_Generation_Rules_Can_Be_Overriden()
        {
            string emailDomain = "afterpaytest.com";
            var    fakePerson  = new RandomPerson("de-DE").RuleFor(u => u.Email,
                                                                   (f, u) => f.Internet.Email(u.FirstName, u.LastName, emailDomain).ToLower()).GetPerson;

            Assert.EndsWith(emailDomain, fakePerson.Email);
        }
コード例 #3
0
ファイル: Test.cs プロジェクト: ZhilenkovArtem/ZhilenkovAA
        /// <summary>
        /// Точка входа
        /// </summary>
        /// <param name="args">Аргументы</param>
        static void Main(string[] args)
        {
            var people = new PersonList();

            for (int j = 0; j < 7; j++)
            {
                people.AddPerson(RandomPerson.CreateRandomPerson());
            }

            ShowList(people);

            Console.WriteLine("Определение типа 4-го элемента и выполнение " +
                              "какого-нибудь метода:");

            FourthPerson(people);

            Console.ReadKey();
        }
コード例 #4
0
        public void GetPerson_Generates_Persons_With_Different_PersonalIds(string locale)
        {
            var randomPerson = new RandomPerson(locale);

            Assert.NotEqual(randomPerson.GetPerson.PersonalIdNumber, randomPerson.GetPerson.PersonalIdNumber);
        }
コード例 #5
0
        public void GetPerson_Generates_Persons_With_Different_Names(string locale)
        {
            var randomPerson = new RandomPerson(locale);

            Assert.NotEqual(randomPerson.GetPerson.FullName, randomPerson.GetPerson.FullName);
        }
コード例 #6
0
        /// <summary>
        /// Точка входа в программу
        /// </summary>
        /// <param name="args">Параметры</param>
        public static void Main(string[] args)
        {
            Console.WriteLine("Press any key to start...");
            Console.WriteLine();
            Console.ReadKey();
            Console.WriteLine("Step 1. Two lists of persons are creating, " +
                              "each contains three persons...");
            Console.WriteLine();
            Console.ReadKey();

            var listOne = new PersonList();
            var listTwo = new PersonList();

            var arrayOne = new Person[]
            {
                new Person("Bender", "Rodriguez", 40, Sex.Male),
                new Person("Philip junior", "Fry", 28, Sex.Male),
                new Person("Sean", "Diaz", 10, Sex.Female),
            };

            var arrayTwo = new Person[]
            {
                new Person("Eric", "Cartman", 12, Sex.Male),
                new Person("albus-severus", "Potter", 11, Sex.Male),
                new Person("Bojack", "Horseman", 50, Sex.Male),
            };

            listOne.AddArrayOfPeople(arrayOne);
            listTwo.AddArrayOfPeople(arrayTwo);

            Console.WriteLine("Two lists of persons have been sucсessfully created!");
            Console.ReadKey();

            Console.WriteLine();
            Console.WriteLine("Step 2. Displaying the contents of " +
                              "each list to the console...");
            ShowListOfPersons(listOne, listTwo);
            Console.WriteLine();

            Console.WriteLine("Step 3. Adding a new person to the first list... ");
            listOne.AddPerson(new Person("Doctor", "Zoidberg", 98, Sex.Male));
            ShowListOfPersons(listOne, listTwo);
            Console.WriteLine();
            Console.WriteLine("A new person has been successfully added" +
                              " to the first list!");
            Console.ReadKey();

            Console.WriteLine();
            Console.WriteLine("Step 4. Copying the second person from the first" +
                              " list to the end of the second list... ");
            listTwo.AddPerson(listOne.FindByIndex(1));
            ShowListOfPersons(listOne, listTwo);
            Console.WriteLine();
            Console.WriteLine("Now the same person is on both lists!");
            Console.WriteLine();
            Console.ReadKey();

            Console.WriteLine("Step 5. Removing the second person from the first list...");
            listOne.DeleteByIndex(1);
            ShowListOfPersons(listOne, listTwo);
            Console.WriteLine();
            Console.WriteLine("Removing a person from the 1st list did not " +
                              "delete the same person in the 2nd list!");
            Console.WriteLine();
            Console.ReadKey();

            Console.WriteLine("Step 6. Clearing the second list...");
            listTwo.DeleteAllPeople();
            ShowListOfPersons(listOne, listTwo);
            Console.WriteLine("All persons have been successfully removed from the 2nd list!");
            Console.WriteLine();
            Console.ReadKey();

            Console.WriteLine("Step 7. Let's add a new person " +
                              "to the second list from keyboard...");
            Console.WriteLine();
            listTwo.AddPerson(AddConsolePerson.NewPerson());
            ShowListOfPersons(listOne, listTwo);
            Console.WriteLine();

            Console.WriteLine("Step 8. Add a random person " +
                              "to the second list...");
            Person randPerson = RandomPerson.GetRandomPerson();

            listTwo.AddPerson(randPerson);
            ShowListOfPersons(listOne, listTwo);
            Console.WriteLine();
            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }