示例#1
0
        public void Fts5CommandDelete([IncludeDataSources(TestProvName.AllSQLite)] string context)
        {
            using (var db = new TestDataConnection(context))
            {
                db.AddMappingSchema(SetupFtsMapping(SQLiteFTS.FTS5));

                try
                {
                    var record = new FtsTable()
                    {
                        text1 = "one",
                        text2 = "two"
                    };

                    db.FTS5Delete(db.GetTable <FtsTable>(), 2, record);
                }
                catch
                {
                    // we don't have FTS5 table, but we need to get sql for validation
                }
                finally
                {
                    Assert.AreEqual("INSERT INTO [FTS5_TABLE]([FTS5_TABLE], rowid, [text1], [text2]) VALUES('delete', 2, @p0, @p1)", db.LastQuery);
                    Assert.AreEqual(2, db.Command.Parameters.Count);
                    Assert.AreEqual("one", ((DbParameter)db.Command.Parameters[0]).Value);
                    Assert.AreEqual("two", ((DbParameter)db.Command.Parameters[1]).Value);
                }
            }
        }