mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-19 20:47:39 -05:00
test(server): share the raw SQLite helpers
Nine server test classes opened the test database with their own identical Execute and Scalar helpers. They now import TestDatabase. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e5d9e12df9
commit
a72e9eb900
10 files changed
+37
-162
No files matched your search
@@ -5,6 +5,7 @@ using Microsoft.Data.Sqlite;
|
||||
using OpenNest.Data;
|
||||
using static OpenNest.Server.Tests.DrawingLibraryFixtures;
|
||||
using static OpenNest.Server.Tests.DrawingSetFixtures;
|
||||
using static OpenNest.Server.Tests.TestDatabase;
|
||||
|
||||
namespace OpenNest.Server.Tests;
|
||||
|
||||
@@ -326,22 +327,4 @@ public sealed class DrawingLibraryDatabaseTests
|
||||
}
|
||||
return text.ToString();
|
||||
}
|
||||
|
||||
private static void Execute(string path, string sql)
|
||||
{
|
||||
using var connection = new SqliteConnection($"Data Source={path};Pooling=False");
|
||||
connection.Open();
|
||||
using var command = connection.CreateCommand();
|
||||
command.CommandText = sql;
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
private static object? Scalar(string path, string sql)
|
||||
{
|
||||
using var connection = new SqliteConnection($"Data Source={path};Pooling=False");
|
||||
connection.Open();
|
||||
using var command = connection.CreateCommand();
|
||||
command.CommandText = sql;
|
||||
return command.ExecuteScalar();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user