diff --git a/test/FluentCommand.Generators.Tests/Snapshots/DataReaderFactoryWriterTests.Generate.verified.txt b/test/FluentCommand.Generators.Tests/Snapshots/DataReaderFactoryWriterTests.Generate.verified.txt index 71d8123..774858b 100644 --- a/test/FluentCommand.Generators.Tests/Snapshots/DataReaderFactoryWriterTests.Generate.verified.txt +++ b/test/FluentCommand.Generators.Tests/Snapshots/DataReaderFactoryWriterTests.Generate.verified.txt @@ -101,11 +101,11 @@ namespace FluentCommand.Entities if (dataRecord == null) throw new global::System.ArgumentNullException(nameof(dataRecord)); - int v_id = default; - string v_name = default; - bool v_isActive = default; - System.DateTimeOffset v_updated = default; - byte[] v_rowVersion = default; + int v_id = default!; + string v_name = default!; + bool v_isActive = default!; + System.DateTimeOffset v_updated = default!; + byte[] v_rowVersion = default!; for (var __index = 0; __index < dataRecord.FieldCount; __index++) { diff --git a/test/FluentCommand.SqlServer.Tests/DataConfigurationTests.cs b/test/FluentCommand.SqlServer.Tests/DataConfigurationTests.cs index 82d56b7..1ad504c 100644 --- a/test/FluentCommand.SqlServer.Tests/DataConfigurationTests.cs +++ b/test/FluentCommand.SqlServer.Tests/DataConfigurationTests.cs @@ -37,8 +37,7 @@ public void GetServices() var sqlGenerator = services.GetService(); sqlGenerator.Should().NotBeNull(); - - + var dataCache = services.GetService(); dataCache.Should().NotBeNull(); @@ -48,5 +47,22 @@ public void GetServices() var sessionFactory = services.GetService(); sessionFactory.Should().NotBeNull(); + var dataConfiguration = services.GetService(); + dataConfiguration.Should().NotBeNull(); + dataConfiguration.ConnectionString.Should().NotEndWith("ApplicationIntent=ReadOnly;"); + + var dataSession = services.GetService(); + dataSession.Should().NotBeNull(); + + var readonlyFactory = services.GetService>(); + readonlyFactory.Should().NotBeNull(); + + var readonlyConfiguration = services.GetService>(); + readonlyConfiguration.Should().NotBeNull(); + readonlyConfiguration.ConnectionString.Should().EndWith("ApplicationIntent=ReadOnly;"); + + var readonlySession = services.GetService>(); + readonlySession.Should().NotBeNull(); + } } diff --git a/test/FluentCommand.SqlServer.Tests/DatabaseFixture.cs b/test/FluentCommand.SqlServer.Tests/DatabaseFixture.cs index 08d3312..55d37fd 100644 --- a/test/FluentCommand.SqlServer.Tests/DatabaseFixture.cs +++ b/test/FluentCommand.SqlServer.Tests/DatabaseFixture.cs @@ -37,6 +37,15 @@ protected override void ConfigureServices(HostBuilderContext context, IServiceCo .AddSqlServerGenerator() .AddDistributedDataCache() ); + + var readOnlyConnection = trackerConnection + "ApplicationIntent=ReadOnly;"; + + services.AddFluentCommand(builder => builder + .UseConnectionString(readOnlyConnection) + .AddProviderFactory(SqlClientFactory.Instance) + .AddSqlServerGenerator() + .AddDistributedDataCache() + ); } } diff --git a/test/FluentCommand.SqlServer.Tests/ReadOnlyIntent.cs b/test/FluentCommand.SqlServer.Tests/ReadOnlyIntent.cs new file mode 100644 index 0000000..cf3d189 --- /dev/null +++ b/test/FluentCommand.SqlServer.Tests/ReadOnlyIntent.cs @@ -0,0 +1,3 @@ +namespace FluentCommand.SqlServer.Tests; + +public readonly struct ReadOnlyIntent { } diff --git a/test/FluentCommand.SqlServer.Tests/appsettings.json b/test/FluentCommand.SqlServer.Tests/appsettings.json index d6831a1..22c9caa 100644 --- a/test/FluentCommand.SqlServer.Tests/appsettings.json +++ b/test/FluentCommand.SqlServer.Tests/appsettings.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "Tracker": "Data Source=(local);Initial Catalog=TrackerTest;Integrated Security=True;TrustServerCertificate=True", + "Tracker": "Data Source=(local);Initial Catalog=TrackerTest;Integrated Security=True;TrustServerCertificate=True;", "DistributedCache": "localhost:6379" } }