C
C#2w ago
Hulkstance

Integration test cases with DB project

I'm currently building integration tests using xUnit and Testcontainers. We use Dapper and the way we handle migrations is not exactly standard. We have a database project and there's a MSBuild PreBuildEvent that keeps track of which migrations have been applied to the DB. Once the DB project builds, it produces a .dacpac file that can then be deployed easily either through CD or manually through SSMS via Upgrade Data-Tier Application. So I can easily spin up a SQL Server container using Testcontainers, but then how do I apply the migrations? Somehow build the DB project from the integration test project and deploy the .dacpac?
1 Reply

Did you find this page helpful?