Files
speckle-sharp-sdk/tests/Speckle.Sdk.Tests.Unit/SQLite/SQLiteJsonExceptionTests.cs
T
Adam Hathcock a84e6d89ca chore(dev) Update to csharpier 1.0 (#284)
* Update to csharpier 1.0

* Fix check and nowarn

* format
2025-04-24 10:45:09 +00:00

26 lines
749 B
C#

using Microsoft.Data.Sqlite;
using Speckle.Sdk.SQLite;
namespace Speckle.Sdk.Tests.Unit.SQLite;
public class SqLiteJsonCacheExceptionTests
{
[Fact]
public void ExpectedExceptionFires_Void()
{
using var pool = new CacheDbCommandPool("DataSource=:memory:", 1);
Assert.Throws<SqLiteJsonCacheException>(() =>
pool.Use(CacheOperation.Get, new Action<SqliteCommand>(_ => throw new SqliteException("test", 1, 1)))
);
}
[Fact]
public void ExpectedExceptionFires_Return()
{
using var pool = new CacheDbCommandPool("DataSource=:memory:", 1);
Assert.Throws<SqLiteJsonCacheException>(() =>
pool.Use(CacheOperation.Get, new Func<SqliteCommand, bool>(_ => throw new SqliteException("test", 1, 1)))
);
}
}