Skip to content

Commit

Permalink
Update DapperTests.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
aritchie committed Jan 25, 2025
1 parent 778c566 commit 8a3ac43
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions tests/Shiny.Mediator.Tests/DapperTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using Dapper;
using DryIoc.Microsoft.DependencyInjection;
using Microsoft.Data.Sqlite;
using Microsoft.Extensions.Hosting;
Expand All @@ -11,24 +12,28 @@ namespace Shiny.Mediator.Tests;

public class DapperTests(ITestOutputHelper output)
{
// const string CONN_STRING = "Host=localhost;Database=;Port=5432;Username=;Password=";
const string CONN_STRING = "Data Source=:memory:";

[Fact]
public async Task Scrutor_EndToEnd()
{
var services = new ServiceCollection();
services.AddShinyMediator(cfg => cfg
.AddDapper<SqliteConnection>(CONN_STRING)
// .AddDapper<NpgsqlConnection>(CONN_STRING)
);

await RunDbHits(services.BuildServiceProvider());
}
// [Fact]
// public async Task Scrutor_EndToEnd()
// {
// var services = new ServiceCollection();
// services.AddShinyMediator(cfg => cfg
// // .AddDapper<SqliteConnection>(CONN_STRING)
// .AddDapper<NpgsqlConnection>(CONN_STRING)
// );
//
// await RunDbHits(services.BuildServiceProvider());
// }

[Fact]
public async Task DryIoc_EndToEnd()
{
using (var conn = new SqliteConnection(CONN_STRING))
{
conn.Open();
conn.Execute("CREATE TABLE Users(Id INTEGER PRIMARY KEY, Email TEXT)");
}
var host = Host
.CreateDefaultBuilder()
.ConfigureLogging(x => x.AddXUnit(output))
Expand All @@ -37,7 +42,6 @@ public async Task DryIoc_EndToEnd()
{
services.AddShinyMediator(cfg => cfg
.AddDapper<SqliteConnection>(CONN_STRING)
// .AddDapper<NpgsqlConnection>(CONN_STRING)
);
})
.Build();
Expand Down

0 comments on commit 8a3ac43

Please sign in to comment.