testcontainers-dotnet icon indicating copy to clipboard operation
testcontainers-dotnet copied to clipboard

[Enhancement]: Refactor Testcontainers.Xunit module

Open digital88 opened this issue 1 month ago • 1 comments

Problem

As per PR the default parameterless Builder constuctor is deprecated. This line in Testcontainers.Xunit module should be refactored to create instances of Builders using new constructor.

See alse comment.

Solution

  • Use factory or delegate to create builders
  • Use InternalsVisibleTo attribute and make default constructor internal instead of deleting it later
  • Use reflection to create builders
  • Something else

Benefit

The working Testcontainers.Xunit module without calling deprecated constructors.

Alternatives

Keep deprecated constructors for some time.

Would you like to help contributing this enhancement?

Yes

digital88 avatar Dec 06 '25 11:12 digital88

@0xced FYI: Testcontainers for .NET (like the other language implementations) expects developers to configure and pin the image in future releases (no more default image: https://github.com/testcontainers/testcontainers-dotnet/discussions/1470).

HofmeisterAn avatar Dec 06 '25 13:12 HofmeisterAn

Thanks for the heads up, Andre. I'll share some thoughts about how we can transition the Testcontainers.Xunit modules to this new approach, hopefully by the end of 2025. Please ping me in 2026 if I don't get around.

0xced avatar Dec 12 '25 16:12 0xced