Example #1
0
        public List <BaseDataModel> GetRandomDataList(int count)
        {
            List <BaseDataModel> contactDatas = new List <BaseDataModel>();

            for (var i = 0; i < count; i++)
            {
                contactDatas.Add(new ContactData
                {
                    Firstname = BaseTest.GenerateRandomString(10),
                    LastName  = BaseTest.GenerateRandomString(100)
                });
            }
            return(contactDatas);
        }
Example #2
0
        List <BaseDataModel> IRandomDataProvider.GetRandomDataList(int count)
        {
            List <BaseDataModel> groupData = new List <BaseDataModel>();

            for (var i = 0; i < count; i++)
            {
                groupData.Add(new GroupData
                {
                    GroupName   = BaseTest.GenerateRandomString(10),
                    GroupFooter = BaseTest.GenerateRandomString(100),
                    GroupHeader = BaseTest.GenerateRandomString(100)
                });
            }
            return(groupData);
        }
Example #3
0
        private static List <GroupData> GenerateGroupsData(int count)
        {
            List <GroupData> groups = new List <GroupData>();

            for (int i = 0; i < count; i++)
            {
                groups.Add(new GroupData(BaseTest.GenerateRandomString(25))
                {
                    Header = BaseTest.GenerateRandomString(25),
                    Footer = BaseTest.GenerateRandomString(25)
                }
                           );
            }

            return(groups);
        }
Example #4
0
        private static List <ContactData> GenerateContactsData(int count)
        {
            List <ContactData> contacts = new List <ContactData>();

            for (int i = 0; i < count; i++)
            {
                contacts.Add(new ContactData(BaseTest.GenerateRandomString(25),
                                             BaseTest.GenerateRandomString(25))
                {
                    Address        = BaseTest.GenerateRandomString(25),
                    Email          = BaseTest.GenerateRandomString(25),
                    Telephone_home = BaseTest.GenerateRandomString(25)
                }
                             );
            }

            return(contacts);
        }
Example #5
0
        static void Main(string[] args)
        {
            string type     = args[0];
            int    count    = Convert.ToInt32(args[1]);
            string filename = args[2];
            //StreamWriter writer = new StreamWriter(args[1]);
            string format = args[3];

            if (type == "groups")
            {
                List <GroupData> groups = new List <GroupData>();
                for (int i = 0; i < count; i++)
                {
                    groups.Add(new GroupData(BaseTest.GenerateRandomString(10))
                    {
                        Header = BaseTest.GenerateRandomString(10),
                        Footer = BaseTest.GenerateRandomString(10)
                    });
                }
                if (format == "excel")
                {
                    WriteGroupsToExcelFile(groups, filename);
                }
                else
                {
                    StreamWriter writer = new StreamWriter(filename);

                    if (format == "csv")
                    {
                        WriteGroupsToCsvFile(groups, writer);
                    }

                    else
                    if (format == "xml")
                    {
                        WriteGroupsToXmFile(groups, writer);
                    }
                    else
                    if (format == "json")
                    {
                        WriteGroupsToJsonFile(groups, writer);
                    }
                    else
                    {
                        System.Console.Out.Write("Unrecognized format" + format);
                    }
                    writer.Close();
                }
            }
            else
            {
                if (type == "contacts")
                {
                    List <ContactData> contact = new List <ContactData>();
                    for (int i = 0; i < count; i++)
                    {
                        contact.Add(new ContactData(BaseTest.GenerateRandomString(10))
                        {
                            Lastname = BaseTest.GenerateRandomString(10),
                            Address  = BaseTest.GenerateRandomString(10),
                            Email    = BaseTest.GenerateRandomString(10),
                            FaxFone  = BaseTest.GenerateRandomString(10)
                        });
                    }
                    StreamWriter writer = new StreamWriter(filename);
                    if (format == "xml")
                    {
                        WriteContactsToXmFile(contact, writer);
                    }
                    else
                    if (format == "json")
                    {
                        WriteContactJsonFile(contact, writer);
                    }
                    else
                    {
                        System.Console.Out.Write("Unrecognized format" + format);
                    }
                    writer.Close();
                }
            }
        }