Esempio n. 1
0
        static void Main(string[] args)
        {
            // Configure Faker
            Faker personFaker = new Faker();

            // Add custom generator
            personFaker.AddGenerator(new IPGenerator(), "IPGenerator");

            List <string> names = new List <string>();

            names.Add("Pepito Perez");
            names.Add("Fulanito Antunez");
            names.Add("Sutanito Gutierrez");
            names.Add("Shurmano Gomez");
            names.Add("Suprimo de los Vientos");

            // Add values to Person name generator
            personFaker.AddList <string>(names, StringLists.PersonName);

            //
            // Test model
            Person person = personFaker.GetFake <Person>();

            // Results
            Console.WriteLine("*** One instance *** ");
            Console.WriteLine();
            PrintPerson(person);
            Console.WriteLine();
            Console.WriteLine("Press enter to continue.");

            Console.ReadLine();

            Console.WriteLine("********************");
            Console.WriteLine("*** 10 instances *** ");
            Console.WriteLine("********************");
            Console.WriteLine();
            List <Person> persons = personFaker.GetFake <Person>(10);

            foreach (Person item in persons)
            {
                PrintPerson(item);
            }

            Console.WriteLine();
            Console.WriteLine("Press enter to exit.");
            Console.ReadLine();
        }