Example #1
0
        public void Setup()
        {
            TestDb.Execute(Resources.testdb_b);

            Action <MySqlClassGenerator> a = delegate(MySqlClassGenerator x)
            {
                x.Formatter.AddAlias("a", "TestAlias1");
                x.Formatter.AddAlias("AbCdEfGhIj");
                x.AddColumnCollection("TestColl", typeof(TestCollEnum), typeof(int), typeof(int), Resources.testdb_b_name,
                                      new ColumnCollectionItem[]
                {
                    ColumnCollectionItem.FromEnum(x.Formatter, "asdfA", TestCollEnum.A),
                    ColumnCollectionItem.FromEnum(x.Formatter, "asdfB", TestCollEnum.B),
                    ColumnCollectionItem.FromEnum(x.Formatter, "asdfC", TestCollEnum.C)
                });

                x.AddColumnCollection("TestCollTwo", typeof(TestCollNestedEnum), typeof(int), typeof(int), Resources.testdb_b_name,
                                      new ColumnCollectionItem[]
                {
                    ColumnCollectionItem.FromEnum(x.Formatter, "bbbbA", TestCollNestedEnum.A),
                    ColumnCollectionItem.FromEnum(x.Formatter, "bbbbB", TestCollNestedEnum.B),
                    ColumnCollectionItem.FromEnum(x.Formatter, "bbbbC", TestCollNestedEnum.C)
                });
            };

            _dbTypes      = ClassCreatorHelper.GetTableTypes(Resources.testdb_b_name, a);
            _dbProperties = ClassCreatorHelper.GetTableTypeProperties(_dbTypes);

            _conn = TestDb.Open();
        }
        private static string[] Act(string[] userNames, string ascDesc)
        {
            var db = new TestDb();

            db.CreateCollation(new Utf8Collation());

            db.Execute("create table Users(Name varchar collate " + Utf8Collation.Collation_Name + ")");

            foreach (var name in userNames)
            {
                db.Execute("insert into Users(Name) values(?)", name);
            }

            var users = db.Query <User>("select Name from Users order by Name " + ascDesc + ";");
            var names = users.Select(s => s.Name).ToArray();

            return(names);
        }
Example #3
0
        public void Setup()
        {
            TestDb.Execute(Resources.testdb_a);
            TestDb.Execute(Resources.testdb_a_view);

            _dbATypes      = ClassCreatorHelper.GetTableTypes(Resources.testdb_a_name);
            _dbAProperties = ClassCreatorHelper.GetTableTypeProperties(_dbATypes);

            _dbAViewTypes      = ClassCreatorHelper.GetTableTypes(Resources.testdb_a_view_name);
            _dbAViewProperties = ClassCreatorHelper.GetTableTypeProperties(_dbAViewTypes);

            _conn = TestDb.Open();
        }