コード例 #1
0
        public ProblemControllerTest()
        {
            // Perform factory set up (once for entire test run)
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c => c.UseDefaultConventions());
                x.AddFromAssemblyContainingType <Member>();

                x.Include <Member>()
                .Setup(m => m.Id).Use <ObjectIdDataSource>()
                .Setup(m => m.OpenId).Random(5, 10)
                .Setup(m => m.UserName).Random(5, 7);

                x.Include <Problem>()
                .Setup(p => p.Id).Use <ObjectIdDataSource>()
                .Setup(p => p.Text).Use <LoremIpsumSource>()
                .Setup(p => p.Title).Random(7, 12);

                x.Include <Response>()
                .Setup(r => r.Text).Use <LoremIpsumSource>();
            });

            // Generate one of these per test (factory will be a static variable most likely)
            _session = factory.CreateSession();
        }
コード例 #2
0
        private void LoadGridData()
        {
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c => { c.UseDefaultConventions(); });
                x.AddFromAssemblyContainingType <SimpleProduct>();

                x.Include <SimpleProduct>()
                .Setup(c => c.ProductName).Use <FirstNameSource>()
                .Setup(c => c.Id).Use <IntegerIdSource>()
                .Setup(c => c.ProductDescription).Use <RandomStringSource>(5, 20);
            });

            var session = factory.CreateSession();
            var r       = new Random(234234);
            var rn      = r.Next(5, 100);
            IList <SimpleProduct> products = session.List <SimpleProduct>(25)
                                             .Impose(x => x.Price, r.Next() * rn)
                                             .Get();
            var bl = new ProductList();

            foreach (var i in products)
            {
                bl.Add(i);
            }

            gv.DataSource = bl;
        }
コード例 #3
0
        static SampleData_LogItem()
        {
            factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c =>
                {
                    c.UseDefaultConventions();
                });

                x.AddFromAssemblyContainingType <LogItem>();

                x.Include <LogItem>()
                .Setup(p => p.EntryAssembly).Use <SubjectDataSource>()
                .Setup(p => p.Class).Use <SubjectDataSource>()
                .Setup(p => p.Method).Use <SubjectDataSource>()
                .Setup(p => p.Message).Use <ContentDataSource>()
                .Setup(p => p.StackTrace).Use <ContentDataSource>()
                .Setup(p => p.CreatedTime).Use <DateTimeSource>(DateTime.UtcNow.AddYears(-10), DateTime.UtcNow.AddYears(10))
                .Setup(p => p.Host).Use <SubjectDataSource>()
                ;
            });

            session = factory.CreateSession();

            randomNumberGenerator = new RandomNumberGenerator();
        }
コード例 #4
0
        static SampleData_ApplicationUser()
        {
            factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c =>
                {
                    c.UseDefaultConventions();
                });

                x.AddFromAssemblyContainingType <ApplicationUser>();

                x.Include <ApplicationUser>()
                .Setup(p => p.Gender).Use <GenderSource>()
                .Setup(p => p.ContactPhone).Use <PhoneDataSource>()
                .Setup(p => p.ContactPhoneExt).Use <PhoneExtDataSource>()
                .Setup(p => p.ForeignSmsEnabled).Use <BooleanSource>()
                .Setup(p => p.Email).Use <EmailAddressSource>()
                .Setup(p => p.EmailConfirmed).Use <BooleanSource>()
                .Setup(p => p.PhoneNumber).Use <MobileDataSource>()
                .Setup(p => p.PhoneNumberConfirmed).Use <BooleanSource>()
                ;
            });

            session = factory.CreateSession();

            randomNumberGenerator = new RandomNumberGenerator();
        }
コード例 #5
0
        static SampleData_Contact()
        {
            factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c =>
                {
                    c.UseDefaultConventions();
                });

                x.AddFromAssemblyContainingType <Contact>();

                x.Include <Contact>()
                .Setup(p => p.Name).Use <FirstNameSource>()
                .Setup(p => p.Mobile).Use <MobileDataSource>()
                .Setup(p => p.HomePhoneArea).Use <PhoneAreaDataSource>()
                .Setup(p => p.HomePhone).Use <PhoneDataSource>()
                .Setup(p => p.CompanyPhoneArea).Use <PhoneAreaDataSource>()
                .Setup(p => p.CompanyPhone).Use <PhoneDataSource>()
                .Setup(p => p.CompanyPhoneExt).Use <PhoneExtDataSource>()
                .Setup(p => p.Email).Use <EmailAddressSource>()
                .Setup(p => p.Msn).Use <MsnDataSource>()
                .Setup(p => p.Description).Use <DescriptionDataSource>()
                .Setup(p => p.Birthday).Use <BirthdaySource>(2005, 2010)
                .Setup(p => p.ImportantDay).Use <BirthdaySource>(2005, 2010)
                .Setup(p => p.Gender).Use <GenderSource>()
                ;
            });

            session = factory.CreateSession();

            randomNumberGenerator = new RandomNumberGenerator();
        }
コード例 #6
0
        public static IGenerationSession GetSession()
        {
            if (_factory == null)
            {
                _factory = GetFactory();
            }

            return(_factory.CreateSession());
        }
        public List <string> CreateAccounts([FromBody] int count)
        {
            List <string> accounts = new List <string>();
            Random        r        = new Random();

            #region Random customer name generator with AutoPoco
            // Perform factory set up (once for entire test run)
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c =>
                {
                    c.UseDefaultConventions();
                });
                x.AddFromAssemblyContainingType <Person>();
                x.Include <Person>().Setup(p => p.FirstName).Use <FirstNameSource>()
                .Setup(p => p.LastName).Use <LastNameSource>();
            });

            // Generate one of these per test (factory will be a static variable most likely)
            IGenerationSession session = factory.CreateSession();

            #endregion

            #region Create N bank accounts

            ServiceEventSource.Current.Message("@AccountsController.Create - Instanciating and initializating '{0}' actors", count);
            // Console.WriteLine(": ");

            for (int j = 0; j < count; j++)
            {
                // generate random account number
                string accountNumber = r.Next(0, 50000000).ToString("00000000");

                // generate name of customer
                Person p            = session.Single <Person>().Get();
                string accountOwner = p.FirstName + " " + p.LastName;

                // generate starting balance for the account. Always multiple of 10 to make it easier to detect changes because of transfers
                int startingBalance = r.Next(0, 10000) * 10;

                // 'create' and initialize the actor
                ActorId      newActorId     = new ActorId(accountNumber);
                IBankAccount newBankAccount = ActorProxy.Create <IBankAccount>(newActorId, "fabric:/SFActors.BankAccounts");
                newBankAccount.InitializeState(accountOwner, startingBalance).GetAwaiter().GetResult();

                // debug
                BankAccountStateBase state = newBankAccount.GetAccountInfo().GetAwaiter().GetResult();
                ServiceEventSource.Current.Message("@AccountsController.Create - " + state.CustomerName + " has €" + state.Balance + " in account nb: " + state.AccountNumber);

                accounts.Add(accountNumber);
            }

            #endregion

            return(accounts);
        }
コード例 #8
0
        private void create100button_Click(object sender, EventArgs e)
        {
            #region Random customer name generator
            // Perform factory set up (once for entire test run)
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c =>
                {
                    c.UseDefaultConventions();
                });
                x.AddFromAssemblyContainingType <Person>();
                x.Include <Person>().Setup(p => p.FirstName).Use <FirstNameSource>()
                .Setup(p => p.LastName).Use <LastNameSource>();
            });

            // Generate one of these per test (factory will be a static variable most likely)
            IGenerationSession session = factory.CreateSession();

            #endregion

            progressBar1.Value = 0;

            for (int j = 0; j < 20; j++)
            {
                // generate account number
                Random r             = new Random();
                string accountNumber = r.Next(0, 50000000).ToString("00000000");

                // generate name
                Person p            = session.Single <Person>().Get();
                string accountOwner = p.FirstName + " " + p.LastName;

                // generate starting balance
                int startingBalance = r.Next(0, 10000);

                // 'create' the actor
                ActorId      newActorId     = new ActorId(accountNumber);
                IBankAccount newBankAccount = ActorProxy.Create <IBankAccount>(newActorId, "fabric:/SFActors.BankAccounts");
                System.Threading.Thread.Sleep(200);

                newBankAccount.InitializeState(accountOwner, startingBalance).GetAwaiter().GetResult();
                System.Threading.Thread.Sleep(200);

                //BankAccountStateBase state = newBankAccount.GetAccountInfo().GetAwaiter().GetResult();
                //textBox1.Text += state.CustomerName + " has £" + state.Balance + " in account " + state.AccountNumber + Environment.NewLine;
                //System.Threading.Thread.Sleep(200);

                _accounts.Add(accountNumber);

                progressBar1.PerformStep();
            }

            textBox1.Text += "100 Bank Account actors created" + Environment.NewLine;
        }
コード例 #9
0
ファイル: PersonTest.cs プロジェクト: scottlaw1/AutoPocoDemo
        public void SetUp()
        {
            factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c => { c.UseDefaultConventions(); });
                x.AddFromAssemblyContainingType<Person>();
            });

            IGenerationSession session = factory.CreateSession();

            people = session.List<Person>(100).Get();
        }
コード例 #10
0
        /// <summary>
        /// This is for generating test data
        /// </summary>
        public AutopocoRepository()
        {
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c => c.UseDefaultConventions());
                x.AddFromAssemblyContainingType <UserModel>();
                x.Include <UserModel>().Setup(r => r.FirstName).Use <FirstNameSource>();
                x.Include <UserModel>().Setup(r => r.LastName).Use <LastNameSource>();
                x.Include <UserModel>().Setup(r => r.Email).Use <EmailAddressSource>();
            });

            Session = factory.CreateSession();
        }
コード例 #11
0
ファイル: DbGenerator.cs プロジェクト: firebitsbr/CloudyBank
        public static void GenerateData()
        {
            IGenerationSessionFactory factory = GenerationFactory.ConfigureFactory();

            IGenerationSession session = factory.CreateSession();

            Role[] roles = CreateAndSaveRoles(Repository);
            IList <CustomerProfile> profiles = CreateAndSaveCustomerProfiles(Repository);

            CreateAndSaveAgencies(session, Repository);
            CreateAndSaveOAuthConsumers(Repository);
            CreateCustomersWithAccounts(session, Repository, roles);

            Repository.Flush();
        }
コード例 #12
0
        public static Person GenerateSinglePerson()
        {
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c => { c.UseDefaultConventions(); });
                x.AddFromAssemblyContainingType <Person>();
                x.Include <Person>()
                .Setup(c => c.Id).Use <IntegerIdSource>()
                .Setup(c => c.FirstName).Use <FirstNameSource>()
                .Setup(c => c.DateEntityCreation).Use <DateOfBirthSource>()
                .Setup(c => c.DateEntityModification).Use <DateOfBirthSource>();
            });

            IGenerationSession session = factory.CreateSession();

            return(session.Single <Person>().Get());
        }
コード例 #13
0
        private static IEnumerable <Customer> GenerateDemoCustomers()
        {
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c => c.UseDefaultConventions());
                x.AddFromAssemblyContainingType <Customer>();

                x.Include <Customer>()
                .Setup(c => c.FirstName).Use <FirstNameSource>()
                .Setup(c => c.LastName).Use <LastNameSource>()
                .Setup(c => c.Mail).Use <EmailAddressSource>()
                .Setup(c => c.DateOfBirth).Use <DateOfBirthSource>();
            });

            IGenerationSession session = factory.CreateSession();

            return(session.List <Customer>(1000).Get());
        }
コード例 #14
0
        private static IEnumerable <Invoice> GenerateDemoInvoices(int customerId)
        {
            Random rnd = new Random(customerId);
            int    amountOfInvoices = rnd.Next(0, 10);

            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c => c.UseDefaultConventions());
                x.AddFromAssemblyContainingType <Invoice>();

                x.Include <Invoice>()
                .Setup(c => c.Amount).Use <DecimalSource>(1m, 200m);
            });

            IGenerationSession session = factory.CreateSession();

            return(session.List <Invoice>(amountOfInvoices).Get());
        }
コード例 #15
0
        public static IList <Person> GeneratePeople(int numregisters)
        {
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c => { c.UseDefaultConventions(); });
                x.AddFromAssemblyContainingType <Person>();
                x.Include <Person>()
                .Setup(c => c.Id).Use <IntegerIdSource>()
                .Setup(c => c.FirstName).Use <FirstNameSource>()
                .Setup(c => c.DateEntityCreation).Use <DateOfBirthSource>()
                .Setup(c => c.DateEntityModification).Use <DateOfBirthSource>();
            });

            IGenerationSession session = factory.CreateSession();

            IList <Person> students = session.List <Person>(numregisters).Get();

            return(students);
        }
コード例 #16
0
        private static IList <Gutachter> GenerateDemoData()
        {
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c => c.UseDefaultConventions());
                x.AddFromAssemblyContainingType <Gutachter>();

                x.Include <Gutachter>()
                .Setup(c => c.Id).Use <IntegerIdSource>()
                .Setup(c => c.Vorname).Use <FirstNameSource>()
                .Setup(c => c.Nachname).Use <LastNameSource>()
                .Setup(c => c.EMail).Use <EmailAddressSource>();
            });

            IGenerationSession session   = factory.CreateSession();
            IList <Gutachter>  gutachter = session.List <Gutachter>(1001).Get();

            gutachter.RemoveAt(0);
            return(gutachter);
        }
コード例 #17
0
        static SampleData_Group()
        {
            factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c =>
                {
                    c.UseDefaultConventions();
                });

                x.AddFromAssemblyContainingType <Group>();

                x.Include <Group>()
                .Setup(p => p.Name).Use <ContactGroupNameSource>()
                .Setup(p => p.Deletable).Use <BooleanSource>()
                ;
            });

            session = factory.CreateSession();

            randomNumberGenerator = new RandomNumberGenerator();
        }
コード例 #18
0
        static SampleData_TradeDetail()
        {
            factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c =>
                {
                    c.UseDefaultConventions();
                });

                x.AddFromAssemblyContainingType <TradeDetail>();

                x.Include <TradeDetail>()
                .Setup(p => p.TradeTime).Use <DateTimeSource>(DateTime.UtcNow.AddYears(-10), DateTime.UtcNow.AddYears(10))
                .Setup(p => p.Remark).Use <ContentDataSource>()
                ;
            });

            session = factory.CreateSession();

            randomNumberGenerator = new RandomNumberGenerator();
        }
コード例 #19
0
        static SampleData_ReplyCc()
        {
            factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c =>
                {
                    c.UseDefaultConventions();
                });

                x.AddFromAssemblyContainingType <ReplyCc>();

                x.Include <ReplyCc>()
                .Setup(p => p.BySmsMessage).Use <BooleanSource>()
                .Setup(p => p.ByEmail).Use <BooleanSource>()
                ;
            });

            session = factory.CreateSession();

            randomNumberGenerator = new RandomNumberGenerator();
        }
コード例 #20
0
        private static IEnumerable <Customer> GenerateDemoCustomers()
        {
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c => c.UseDefaultConventions());
                x.AddFromAssemblyContainingType <Customer>();

                x.Include <Customer>()
                .Setup(c => c.FirstName).Use <FirstNameSource>()
                .Setup(c => c.LastName).Use <LastNameSource>()
                .Setup(c => c.Mail).Use <EmailAddressSource>()
                .Setup(c => c.DateOfBirth).Use <DateOfBirthSource>();
            });

            IGenerationSession session = factory.CreateSession();

            return(session.List <Customer>(1000)
                   .First(100)
                   .Impose(x => x.LastName, "Ashton")
                   .Next(100)
                   .Impose(x => x.LastName, "Smith")
                   .Next(100)
                   .Impose(x => x.LastName, "Dexter")
                   .Next(100)
                   .Impose(x => x.LastName, "Grimes")
                   .Next(100)
                   .Impose(x => x.LastName, "Walsh")
                   .Next(100)
                   .Impose(x => x.LastName, "Rhee")
                   .Next(100)
                   .Impose(x => x.LastName, "Horvath")
                   .Next(100)
                   .Impose(x => x.LastName, "Dixon")
                   .Next(100)
                   .Impose(x => x.LastName, "Jones")
                   .Next(100)
                   .Impose(x => x.LastName, "Martinez")
                   .All()
                   .Get());
        }
コード例 #21
0
        static SampleData_Signature()
        {
            factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c =>
                {
                    c.UseDefaultConventions();
                });

                x.AddFromAssemblyContainingType <Signature>();

                x.Include <Signature>()
                .Setup(p => p.Subject).Use <SubjectDataSource>()
                .Setup(p => p.Content).Use <ContentDataSource>()
                .Setup(p => p.UpdatedTime).Use <DateTimeSource>(DateTime.UtcNow.AddYears(-10), DateTime.UtcNow.AddYears(10))
                ;
            });

            session = factory.CreateSession();

            randomNumberGenerator = new RandomNumberGenerator();
        }
コード例 #22
0
        static SampleData_Blacklist()
        {
            factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c =>
                {
                    c.UseDefaultConventions();
                });

                x.AddFromAssemblyContainingType <Blacklist>();

                x.Include <Blacklist>()
                .Setup(p => p.Name).Use <FirstNameSource>()
                .Setup(p => p.Mobile).Use <MobileDataSource>()
                .Setup(p => p.Enabled).Use <BooleanSource>()
                .Setup(p => p.Remark).Use <RemarkDataSource>()
                .Setup(p => p.UpdatedTime).Use <DateTimeSource>(DateTime.UtcNow.AddYears(-10), DateTime.UtcNow.AddYears(10))
                ;
            });

            session = factory.CreateSession();

            randomNumberGenerator = new RandomNumberGenerator();
        }
コード例 #23
0
        static void Main(string[] args)
        {
            List <string> _accounts = new List <string>();
            Random        r         = new Random();

            #region Random customer name generator with AutoPoco
            // Perform factory set up (once for entire test run)
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c =>
                {
                    c.UseDefaultConventions();
                });
                x.AddFromAssemblyContainingType <Person>();
                x.Include <Person>().Setup(p => p.FirstName).Use <FirstNameSource>()
                .Setup(p => p.LastName).Use <LastNameSource>();
            });

            // Generate one of these per test (factory will be a static variable most likely)
            IGenerationSession session = factory.CreateSession();

            #endregion

            #region Create 100 bank accounts

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Instanciating and initializating 100 actors: ");
            Console.ForegroundColor = ConsoleColor.Gray;

            for (int j = 0; j < 100; j++)
            {
                // generate account number
                string accountNumber = r.Next(0, 50000000).ToString("00000000");

                // generate name
                Person p            = session.Single <Person>().Get();
                string accountOwner = p.FirstName + " " + p.LastName;

                // generate starting balance
                int startingBalance = r.Next(0, 10000);

                // 'create' the actor
                ActorId newActorId = new ActorId(accountNumber);


                IBankAccount newBankAccount = ActorProxy.Create <IBankAccount>(newActorId, "fabric:/SFActors.BankAccounts");
                newBankAccount.InitializeState(accountOwner, startingBalance).GetAwaiter().GetResult();

                BankAccountStateBase state = newBankAccount.GetAccountInfo().GetAwaiter().GetResult();
                Console.WriteLine(state.CustomerName + " has €" + state.Balance + " in account nb: " + state.AccountNumber);

                _accounts.Add(accountNumber);
            }

            #endregion

            #region Create 100 Standing Orders

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("100 Bank Account actors created. Press a key to create 100 standing orders.");
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.ReadLine();

            for (int j = 0; j < 100; j++)
            {
                int posSource = r.Next(0, _accounts.Count);
                int posTarget = r.Next(0, _accounts.Count);

                if (posSource == posTarget)
                {
                    // one less transfer...
                    continue;
                }

                ActorId      sourceAccountId    = new ActorId(_accounts[posSource]);
                IBankAccount sourceAccountProxy = ActorProxy.Create <IBankAccount>(sourceAccountId, "fabric:/SFActors.BankAccounts");

                double howMuch  = r.NextDouble() * 500;
                short  onMinute = (short)r.Next(0, 60);
                sourceAccountProxy.AddStandingOrder(_accounts[posTarget], howMuch, onMinute);
                Console.WriteLine("SO payable to account {0} of €{1:f2} on minute {2}", _accounts[posTarget], howMuch, onMinute);
            }

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("100 Standing orders registered created");
            Console.ForegroundColor = ConsoleColor.Gray;

            #endregion

            #region GO CRAZY with creating objects

            Console.WriteLine();

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write("Enter how many more actors you want to create (and SO's):");
            string more = Console.ReadLine();
            Console.ForegroundColor = ConsoleColor.Gray;

            int howManyMore = int.Parse(more);

            for (int j = 0; j < howManyMore; j++)
            {
                // generate account number
                string accountNumber = r.Next(0, 50000000).ToString("00000000");

                // generate name
                Person p            = session.Single <Person>().Get();
                string accountOwner = p.FirstName + " " + p.LastName;

                // generate starting balance
                int startingBalance = r.Next(0, 10000);

                // 'create' the actor
                ActorId      newActorId     = new ActorId(accountNumber);
                IBankAccount newBankAccount = ActorProxy.Create <IBankAccount>(newActorId, "fabric:/SFActors.BankAccounts");
                newBankAccount.InitializeState(accountOwner, startingBalance).GetAwaiter().GetResult();
                Console.Write("A");

                _accounts.Add(accountNumber);
            }

            for (int j = 0; j < howManyMore; j++)
            {
                int posSource = r.Next(0, _accounts.Count);
                int posTarget = r.Next(0, _accounts.Count);

                if (posSource == posTarget)
                {
                    // one less transfer...
                    continue;
                }

                ActorId      sourceAccountId    = new ActorId(_accounts[posSource]);
                IBankAccount sourceAccountProxy = ActorProxy.Create <IBankAccount>(sourceAccountId, "fabric:/SFActors.BankAccounts");

                double howMuch  = r.NextDouble() * 500;
                short  onMinute = (short)r.Next(0, 60);
                sourceAccountProxy.AddStandingOrder(_accounts[posTarget], howMuch, onMinute);
                Console.Write("S");
            }

            #endregion

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write("Done! Press any key to exit this tool.");
            Console.ReadLine();
            Console.ForegroundColor = ConsoleColor.Gray;
        }
コード例 #24
0
        /// <summary>
        /// Get list of Persons from local store
        /// </summary>
        /// <returns>Returns empty list or all persons</returns>
        public IList <PersonDetails> Get()
        {
            var session = _factory.CreateSession();

            return(session.List <PersonDetails>(10).Get());
        }
コード例 #25
0
        static void Main(string[] args)
        {
            // Perform factory set up (once for entire test run)
            IGenerationSessionFactory factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c =>
                {
                    c.UseDefaultConventions();
                });
                // allows for the scanning of an assembly
                x.AddFromAssemblyContainingType <User>();

                // Optionally Setting up data sources for an object
                // AutoPoco provided built-in data sources:
                // https://autopoco.codeplex.com/wikipage?title=DataSourceList&referringTitle=Configuration
                x.Include <User>()
                .Setup(c => c.Id).Use <IntegerIdSource>()
                .Setup(c => c.EmailAddress).Use <EmailAddressSource>()
                .Setup(c => c.FirstName).Use <FirstNameSource>()
                .Setup(c => c.CreditCard).Use <CreditCardSource>()
                .Setup(c => c.DOB).Use <DateOfBirthSource>()
                .Setup(c => c.LastName).Use <LastNameSource>()
                .Setup(c => c.State).Use <UsStatesSource>(false)                             // true: abbreviated
                .Invoke(c => c.SetPassword(Use.Source <String, RandomStringSource>(8, 16))); // String min, max length
            });

            // Generate one of these per test (factory will be a static variable most likely)
            IGenerationSession session = factory.CreateSession();

            // Get a collection of users based on data sources ONLY
            //IList<User> users = session.List<User>(25).Get();

            // Get a collection of users, with Customization
            IList <User> users = session.List <User>(100)
                                 .Impose(x => x.Role, "Admin")
                                 .Impose(x => x.Age, 21)
                                 .First(1)
                                 .Impose(x => x.FirstName, "Vincent")
                                 .Impose(x => x.LastName, "Leung")
                                 .Next(1)
                                 .Impose(x => x.FirstName, "Kayla")
                                 .Impose(x => x.LastName, "Leung")
                                 .All()
                                 .Random(25)
                                 .Impose(x => x.Role, "Admin")
                                 .Impose(x => x.Age, 35)
                                 .Next(25)
                                 .Impose(x => x.Role, "Guest")
                                 .Invoke(x => x.SetPassword("Password1"))
                                 .Next(50)
                                 .Impose(x => x.Role, "Operator")
                                 .All()
                                 .Get();

            foreach (var u in users)
            {
                Console.WriteLine(u.Id + ", " + u.FirstName + ", " + u.LastName + ", " + u.Age + ", " + u.EmailAddress + ", " + u.DOB
                                  + ", " + u.CreditCard + ", " + u.Role + ", " + u.State + ", " + u.Password
                                  );
            }

            // Get a single user
            User user = session.Single <User>().Get();

            Console.ReadLine();
        }