public void TestChangesCount() { var initialChangesCount = 0; var insertChangesCount = 0; var numRecords = this.rnd.Next(1, 11); var insertedRecords = new List<Tuple<int, long, string, double>>(numRecords); for (var i = 0; i < numRecords; i++) { insertedRecords.Add(new Tuple<int, long, string, double>(i, this.GetRandomInteger(), this.GetRandomString(), this.GetRandomReal())); } using (var connection = new SQLiteConnection(this.databaseRelativePath)) { using (var statement = connection.Prepare("DROP TABLE IF EXISTS TestQuery;")) { statement.Step(); } using (var statement = connection.Prepare("CREATE TABLE TestQuery(id INTEGER, i INTEGER, t TEXT, r REAL);")) { statement.Step(); } initialChangesCount = connection.ChangesCount(); foreach (var record in insertedRecords) { var command = "INSERT INTO TestQuery(id, i, t, r) VALUES(" + record.Item1.ToString(this.invClt) + "," + record.Item2.ToString(this.invClt) + ",'" + record.Item3 + "'," + record.Item4.ToString(this.invClt) + ");"; using (var statement = connection.Prepare(command)) { statement.Step(); } insertChangesCount += connection.ChangesCount(); } using (var statement = connection.Prepare("DROP TABLE TestQuery;")) { statement.Step(); } } Assert.AreEqual(0, initialChangesCount); Assert.AreEqual(insertedRecords.Count, insertChangesCount); }