Reputation: 837
I have this NUnit test:
using System.Data.SQLite;
[Test]
public async Task InMemoryTest()
{
using var connection = new SQLiteConnection(
"Data Source=file:abc?mode=memory&cache=shared;"
);
await connection.OpenAsync();
var command = connection.CreateCommand();
command.CommandText = "CREATE TABLE MyTable (MyColumn int);";
_ = await command.ExecuteNonQueryAsync();
await connection.CloseAsync();
}
It just creates a table in an in-memory database. When I run the test the first time, it passes. When I run it the second time (in another process), it fails saying that the table is already created.
What is very strange is that I can't find any persisted DB file on disk. Why does the table seem to be persisted between test runs?
Edit: The same issue occurs with this connection string:
Data Source=abc;mode=memory;cache=shared;
Upvotes: 0
Views: 67