コード例 #1
0
        public void UpperAndLowerColumnNames()
        {
            using (var db = new TestDb(true)
            {
                TraceListener = DebugTraceListener.Instance
            })
            {
                db.CreateTable <LowerId>();
                db.CreateTable <UpperId>();

                List <SQLiteConnection.ColumnInfo> cols = db.GetTableInfo("Test").ToList();
                Assert.That(cols.Count, Is.EqualTo(1));
                Assert.That(cols[0].Name, Is.EqualTo("Id"));
            }
        }
コード例 #2
0
        public void CreateTableWithNotNullConstraints()
        {
            using (var db = new TestDb())
            {
                db.CreateTable <NotNullNoPK>();
                var cols = db.GetTableInfo("NotNullNoPK");

                var joined = from expected in GetExpectedColumnInfos(typeof(NotNullNoPK))
                             join actual in cols on expected.Name equals actual.Name
                             where actual.notnull != expected.notnull
                             select actual.Name;

                Assert.AreNotEqual(0, cols.Count(), "Failed to get table info");
                Assert.IsTrue(joined.Count() == 0, string.Format("not null constraint was not created for the following properties: {0}"
                                                                 , string.Join(", ", joined.ToArray())));
            }
        }