PlanTempusApp/Tests/PostgresTests.cs

77 lines
2.4 KiB
C#
Raw Normal View History

using Autofac;
using System.Data;
using Insight.Database;
namespace PlanTempus.Tests
{
[TestClass]
public class PostgresTests : TestFixture
{
[TestMethod]
public void TestDefaultConnection()
{
var conn = Container.Resolve<IDbConnection>();
//https://www.reddit.com/r/dotnet/comments/6wdoyn/how_to_properly_register_dapper_on_net_core_2_di/
//https://www.code4it.dev/blog/postgres-crud-dapper/
//https://stackoverflow.com/questions/69169247/how-to-create-idbconnection-factory-using-autofac-for-dapper
conn.ExecuteSql("SELECT 1 as p");
}
2025-02-17 17:42:46 +01:00
//static HttpClient _client = new HttpClient();
//[TestMethod]
//public async Task MyTestMethod()
//{
// _client.BaseAddress = new Uri("http://localhost:5341");
2025-02-17 17:42:46 +01:00
// var l = new SeqLogger(_client, "", "");
2025-02-17 17:42:46 +01:00
// for (int i = 0; i < 20; i++)
// {
2025-02-17 17:42:46 +01:00
// await l.LogToSeq(
// "Bruger {UserId} loggede ind",
// "Debug",
// new Dictionary<string, object> { { "UserId", "12345" }, { "Counter", i++ } }
// );
// }
// var logger = Container.Resolve<Microsoft.ApplicationInsights.TelemetryClient>();
2025-02-17 17:42:46 +01:00
// for (int i = 0; i < 5; i++)
// {
2025-02-17 17:42:46 +01:00
// logger.TrackTrace("Hello 23", Microsoft.ApplicationInsights.DataContracts.SeverityLevel.Information);
2025-02-17 17:42:46 +01:00
// }
2025-02-17 17:42:46 +01:00
//}
[TestMethod]
2025-02-14 20:14:01 +01:00
public void TryOrganizationSetupService()
{
var conn = Container.Resolve<IDbConnection>();
}
[TestMethod]
public async Task TryDbSetup()
{
//var conn = Container.Resolve<IDbConnection>();
//var identitySystem = new Database.Core.SetupIdentitySystem(conn);
//identitySystem.CreateSystem("swp");
}
[TestMethod]
public void SetupPostgresql_LISTEN()
{
//var builder = new ConfigurationBuilder()
// .AddPostgresConfiguration(options =>
// {
// options.ConnectionString = "Host=192.168.1.57;Database=ptdb01;Username=postgres;Password=3911";
// options.Channel = "config_changes";
// options.ConfigurationQuery = @"select * from dev.app_configuration";
// });
}
}
}