Our great sponsors
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
dotnet-testcontainers
Discontinued 🐋 A library to support tests with throwaway instances of Docker containers for all compatible .NET Standard versions. [Moved to: https://github.com/testcontainers/testcontainers-dotnet]
If you are using xUnit.net, you can probably achieve the same via a collection fixture, if you're on MSTest V2, you can probably use the [AssemblyInitialize] hook, you can find more info on StackOverflow
Depending on the test framework you use, you have to find the proper hook to tell testcontainers to start your SQL Server Docker container just before test execution starts. I am using NUnit so the hook I picked is a class in the root namespace of the integration test project with the [SetupFixture] attribute applied to it.
Dotnet.Testcontainers also comes with some built-in classes that wraps various services, one of these classes actually wraps a SQL Server Docker container and there are few more that covers the most common databases e.g.