public void SetUp(DataSet dataSource)
        {
            if (dataSource is NorthwindDataSet)
                Assert.Ignore("Northwind is buggy... because import in VC# is buggy");
            this.Admin.CreateDatabase();

            dataSource.EnforceConstraints = true;
            this.graph = DataGraph.Create(dataSource);

            this.pop = new DatabasePopulator();
            this.pop.Populate(dataSource);

            // add one row data per table
            foreach (DataTable table in this.graph.GetSortedTables())
            {
                ITablePopulator tp = this.pop.Tables[table];
                tp.Generate();
                table.Rows.Add(tp.Row);
                table.AcceptChanges();
            }

            this.gen = new SqlGenerator(
                this.ConnectionString,
                this.DatabaseName,
                dataSource
                );
        }
Пример #2
0
        public void SetUp(DataSet dataSource)
        {
            if (dataSource is NorthwindDataSet)
            {
                Assert.Ignore("Northwind is buggy... because import in VC# is buggy");
            }
            this.Admin.CreateDatabase();

            dataSource.EnforceConstraints = true;
            this.graph = DataGraph.Create(dataSource);

            this.pop = new DatabasePopulator();
            this.pop.Populate(dataSource);

            // add one row data per table
            foreach (DataTable table in this.graph.GetSortedTables())
            {
                ITablePopulator tp = this.pop.Tables[table];
                tp.Generate();
                table.Rows.Add(tp.Row);
                table.AcceptChanges();
            }

            this.gen = new SqlGenerator(
                this.ConnectionString,
                this.DatabaseName,
                dataSource
                );
        }
Пример #3
0
        public UserOrderProductGrammar()
        {
            this.db  = new UserOrderProductDataSet();
            this.pop = new DatabasePopulator();
            this.pop.Populate(this.db);

            this.ProductionFinished += new EventHandler(UserOrderProductGrammar_ProductionFinished);

            // create rules
            this.addUser         = Rules.Method(new MethodInvoker(this.AddUser));
            this.addOrder        = Rules.Method(new MethodInvoker(this.AddOrder));
            this.addProduct      = Rules.Method(new MethodInvoker(this.AddProduct));
            this.addOrderProduct = Rules.Method(new MethodInvoker(this.AddOrderProduct));

            // guarded rules
            this.guardAddOrder        = Rules.Guard(this.addUser, typeof(InvalidOperationException));
            this.guardAddOrderProduct = Rules.Guard(this.addOrderProduct, typeof(InvalidOperationException));

            this.init = Rules.Seq(this.addUser, this.addProduct, this.addOrder);

            this.StartRule = Rules.Seq(this.init,
                                       Rules.Kleene(
                                           Rules.Alt(
                                               this.addUser,
                                               this.addOrder,
                                               this.addProduct,
                                               this.addOrderProduct
                                               )
                                           )
                                       );
        }
Пример #4
0
        public TablePopulator(IDatabasePopulator database,DataTable table)
        {
            if (database==null)
                throw new ArgumentNullException("database");
            if (table==null)
                throw new ArgumentNullException("table");

            this.database = database;
            this.table = table;
            this.uniques=new UniqueValidatorCollection(this);
            this.foreignKeys=new ForeignKeyProviderCollection(this);

            this.PopulateDataGenerators();
            this.PopulateUniques();
        }
Пример #5
0
        public TablePopulator(IDatabasePopulator database, DataTable table)
        {
            if (database == null)
            {
                throw new ArgumentNullException("database");
            }
            if (table == null)
            {
                throw new ArgumentNullException("table");
            }

            this.database    = database;
            this.table       = table;
            this.uniques     = new UniqueValidatorCollection(this);
            this.foreignKeys = new ForeignKeyProviderCollection(this);

            this.PopulateDataGenerators();
            this.PopulateUniques();
        }