diff --git a/src/Serilog.Ui.SqliteDataProvider/Serilog.Ui.SqliteDataProvider.csproj b/src/Serilog.Ui.SqliteDataProvider/Serilog.Ui.SqliteDataProvider.csproj index a9e629ff..fa900876 100644 --- a/src/Serilog.Ui.SqliteDataProvider/Serilog.Ui.SqliteDataProvider.csproj +++ b/src/Serilog.Ui.SqliteDataProvider/Serilog.Ui.SqliteDataProvider.csproj @@ -12,7 +12,7 @@ - + diff --git a/tests/Serilog.Ui.SqliteProvider.Tests/Serilog.Ui.SqliteProvider.Tests.csproj b/tests/Serilog.Ui.SqliteProvider.Tests/Serilog.Ui.SqliteProvider.Tests.csproj index bf620eb6..182a83e5 100644 --- a/tests/Serilog.Ui.SqliteProvider.Tests/Serilog.Ui.SqliteProvider.Tests.csproj +++ b/tests/Serilog.Ui.SqliteProvider.Tests/Serilog.Ui.SqliteProvider.Tests.csproj @@ -7,6 +7,7 @@ + diff --git a/tests/Serilog.Ui.SqliteProvider.Tests/Util/SqliteTestProvider.cs b/tests/Serilog.Ui.SqliteProvider.Tests/Util/SqliteTestProvider.cs index 4a288ac3..1fa53ad6 100644 --- a/tests/Serilog.Ui.SqliteProvider.Tests/Util/SqliteTestProvider.cs +++ b/tests/Serilog.Ui.SqliteProvider.Tests/Util/SqliteTestProvider.cs @@ -3,7 +3,6 @@ using Microsoft.Data.Sqlite; using Serilog; using Serilog.Ui.Common.Tests.DataSamples; -using Serilog.Ui.Common.Tests.SqlUtil; using Serilog.Ui.Common.Tests.TestSuites; using Serilog.Ui.Core; using Serilog.Ui.Core.Extensions; @@ -28,18 +27,20 @@ public SqliteTestProvider() : base() // No need to set up a container for SQLite - using in-memory database } - public SqliteDbOptions DbOptions { get; set; } = new SqliteDbOptions().WithTable("Logs"); + public SqliteDbOptions DbOptions { get; set; } = new SqliteDbOptions() + .WithTable("Logs") + .WithConnectionString("Data Source=hello.db"); private async Task CheckDbReadinessAsync() { Guard.Against.Null(DbOptions); - using var connection = new SqliteConnection("DataSource=:memory:"); + using var connection = new SqliteConnection(DbOptions.ConnectionString); await connection.OpenAsync(); - DbOptions.WithConnectionString(connection.ConnectionString); - await connection.ExecuteAsync("SELECT 1"); + + InitializeAdditional(); } private void InitializeAdditional() @@ -47,7 +48,7 @@ private void InitializeAdditional() var serilog = new SerilogSinkSetup(logger => logger .WriteTo - .SQLite(DbOptions.ConnectionString)); + .SQLite(@"hello.db", batchSize: 1)); _collector = serilog.InitializeLogs(); _provider = new SqliteDataProvider(DbOptions, new SqliteQueryBuilder()); @@ -57,20 +58,13 @@ private void InitializeAdditional() public LogModelPropsCollector GetPropsCollector() => _collector!; - public async Task InitializeAsync() + public Task InitializeAsync() { - await CheckDbReadinessAsync(); - InitializeAdditional(); + return CheckDbReadinessAsync(); } - public Task DisposeAsync() - { - return Task.CompletedTask; - } - - public void Dispose() - { + public Task DisposeAsync() => Task.CompletedTask; - } + public void Dispose() { } } }