Skip to content

[Repo Assist] test: expand DesignTimeConnectionStringTests and add net8.0 multi-targeting#455

Draft
github-actions[bot] wants to merge 2 commits intomasterfrom
repo-assist/test-improve-designtime-20260310-707344d4ae85621b
Draft

[Repo Assist] test: expand DesignTimeConnectionStringTests and add net8.0 multi-targeting#455
github-actions[bot] wants to merge 2 commits intomasterfrom
repo-assist/test-improve-designtime-20260310-707344d4ae85621b

Conversation

@github-actions
Copy link

🤖 This is an automated PR from Repo Assist.

Summary

The existing SqlClient.DesignTime.Tests project had only 3 test cases and was restricted to net462. This PR expands coverage and enables the tests to run on modern .NET.

Changes

tests/SqlClient.DesignTime.Tests/SqlClient.DesignTime.Tests.fsproj

  • Changed TargetFrameworkTargetFrameworks: net462;net8.0 (consistent with SqlClient.Tests which already multi-targets)
  • The net8.0 reference to FSharp.Data.SqlClient.DesignTime.dll was already in the project file; this makes it active

tests/SqlClient.DesignTime.Tests/DesignTimeConnectionStringTests.fs

  • Fixed module-level adventureWorks binding to use DesignTimeConnectionString.Parse (reads from app.config via ConfigurationManager.OpenMappedExeConfiguration) instead of ConfigurationManager.ConnectionStrings (which isn't populated in .NET Core xUnit test hosts), fixing the TypeInitializationException that prevented 3 tests from running on .NET 8
  • Added 8 new test cases (total: 3 → 11):
New test What it covers
Literal connection string returns Literal case Parse returns Literal discriminated union for non-name= strings
Literal IsDefinedByLiteral is true .IsDefinedByLiteral property returns true for literals
Literal Value returns the connection string .Value returns the original string for literals
Literal RunTimeValueExpr evaluates to the original string Quotation evaluates to the literal value without config lookup
name= prefix with spaces is still parsed as NameInConfig Whitespace around = is handled correctly
Missing connection name in config throws KeyNotFoundException ReadFromConfig raises correct exception for unknown names
NameInConfig IsDefinedByLiteral is false .IsDefinedByLiteral returns false for config-based strings
NameInConfig Value returns the connection string from config .Value matches what the config file says

Test Status

net8.0 (verified locally): ✅ 10/11 pass.

The single failing test (RuntimeConfig) exercises the non-hosted execution code path where ConfigurationManager.ConnectionStrings is read at runtime. This path is not populated in .NET Core xUnit test hosts — this is expected and pre-existing behaviour. The test continues to pass on net462 where ConfigurationManager.ConnectionStrings is automatically populated.

net462: Requires Windows/.NET Framework — not verifiable in this Linux CI environment. The new tests are logically equivalent to the existing ones and should continue to pass.

Building the DesignTime project in CI requires either:

  1. Building via the full build pipeline (Paket + MSBuild), OR
  2. Passing -p:PaketExePath=(path-to-paket.dll) to bypass the legacy bootstrapper (workaround used in this environment)

PR #444 (engineering overhaul) would resolve the build infrastructure issues on modern .NET CI.

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f

- Add 8 new test cases covering Literal vs NameInConfig cases:
  - Literal parsing, IsDefinedByLiteral, Value, RunTimeValueExpr
  - Name prefix with spacing variants
  - Missing connection name (KeyNotFoundException)
  - NameInConfig IsDefinedByLiteral is false
  - NameInConfig Value from config
- Fix adventureWorks module-level binding to use DesignTimeConnectionString.Parse
  instead of ConfigurationManager.ConnectionStrings, so tests work on both
  .NET Framework and .NET Core (ConfigurationManager.ConnectionStrings is not
  automatically populated in xUnit test hosts on .NET Core)
- Update project to target net462;net8.0 so design-time tests can run in
  modern CI environments (net8.0 already had a conditional reference in the project)
- Add FSharp.Core binding redirect for net462

Test status (net8.0): 10/11 pass. RuntimeConfig fails because it exercises
the non-hosted code path that reads from ConfigurationManager.ConnectionStrings,
which is not populated in .NET Core test hosts — this is expected behaviour.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants