예제 #1
0
        static void Main(string[] args)
        {
            //Setup
            var setup = new GeneratorSetup();

            setup.RegisterEntity <Buyer>()
            .SetGenerator(GenerateBuyer)
            .SetPersistentStorage(new CsvPersistentStorage("Set-Buyers.csv"))
            .SetTargetCount(100);
            setup.RegisterEntity <Supplier>()
            .SetGenerator(GenerateSupplier)
            .SetPersistentStorage(new CsvPersistentStorage("Set-Suppliers.csv"))
            .SetTargetCount(100);
            setup.RegisterEntity <PurchaseOrder>()
            .SetGenerator <Supplier, Buyer>(GeneratePurchaseOrder)
            .AddMultiModifier <Supplier, Buyer>(ModifyPurchaseOrders)
            .SetPersistentStorage(new CsvPersistentStorage("Set-PurchaseOrders.csv"))
            .SetSpreadStrategy(new CartesianProductSpreadStrategy())
            .SetTargetCount(100000);

            //Generate
            setup.ProgressChanged += PrintProgress;
            setup.Generate();
            Console.WriteLine("Completed");
            Console.ReadKey();
        }
예제 #2
0
            protected override void When()
            {
                _generatorSetup.Generate();

                _insertedPosts = SampleDatabase.Posts
                                 .Where(x => x.MarkerText == _markerString)
                                 .ToList();
                _insertedCategories = SampleDatabase.Categories
                                      .Where(x => x.MarkerText == _markerString)
                                      .ToList();
                _insertedComments = SampleDatabase.Comments
                                    .Where(x => x.MarkerText == _markerString)
                                    .ToList();
            }
        //generate entry point
        public InMemoryStorage Generate(SpecsDbContext dbContext, IGeneratorData generatorData,
                                        bool useMemoryStorage, Dictionary <Type, long> ammounts)
        {
            var setup = new GeneratorSetup();

            generatorData.RegisterEntities(setup, dbContext);
            SetDataAmounts(setup, ammounts);
            InMemoryStorage storage = useMemoryStorage
                ? SetMemoryStorage(setup, ammounts)
                : null;

            setup.ProgressChanged += PrintProgress;
            setup.Generate();

            return(storage);
        }