If I insert in a transaction and roll that transaction back I would expect that the table would be empty. Instead it is not. This affects InMemoryAdapter.
[TestClass]
public sealed class SimpleDataRollbackTest
{
[TestInitialize]
public void Setup()
{
Database.UseMockAdapter(new InMemoryAdapter());
}
[TestCleanup]
public void TearDown()
{
Database.StopUsingMockAdapter();
}
[TestMethod]
public void Rollback()
{
var db = Database.Open();
Assert.AreEqual(0, db.MyTable.All().Count());
using (var transaction = db.BeginTransaction())
{
transaction.MyTable.Insert(ID: 1);
Assert.AreEqual(1, transaction.MyTable.All().Count());
transaction.Rollback();
}
Assert.AreEqual(0, db.MyTable.All().Count());
}
}
Initially I was not using the transaction correctly: db.MyTable.Insert(ID: 1); rather than transaction.MyTable.Insert(ID: 1); Now I do, it works with actual DB, but still not with in-memory, so updated the issue.
If I insert in a transaction and roll that transaction back I would expect that the table would be empty. Instead it is not. This affects InMemoryAdapter.