为什么我使用 localdb 的测试在 Azure DevOps 中运行良好?
Why my tests with localdb works fine in Azure DevOps?
我将 Azure DevOps 用于我的 .NET Core 应用程序的 CI 进程。
我还使用基于 localDb SQL 数据库的集成测试。
当我 运行 我的 ci piplene 时,我很惊讶所有测试都通过了。
{
"UseInMemoryDatabase": false, // Application.IntegrationTests are not designed to work with InMemory database.
"DeveloperPathSqlConnectionString": "Server=(localdb)\mssqllocaldb;Database=DeveloperPathTestDb;Trusted_Connection=True;MultipleActiveResultSets=true;",
"Key": {
"Type": "Development"
},
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
Azure DevOps 是否已包含 localdb?
Does Azure DevOps already contain the localdb?
答案是肯定的。
windows 映像包含 localdb。 hosted windows agent 附带 Visual Studio,其中包括 LocalDB。
您可以使用以下启动命令来验证:
pool:
vmImage: 'windows-latest'
- task: PowerShell@2
displayName: 'start mssqllocaldb'
inputs:
targetType: 'inline'
script: 'sqllocaldb start mssqllocaldb'
测试结果:
我将 Azure DevOps 用于我的 .NET Core 应用程序的 CI 进程。 我还使用基于 localDb SQL 数据库的集成测试。 当我 运行 我的 ci piplene 时,我很惊讶所有测试都通过了。
{
"UseInMemoryDatabase": false, // Application.IntegrationTests are not designed to work with InMemory database.
"DeveloperPathSqlConnectionString": "Server=(localdb)\mssqllocaldb;Database=DeveloperPathTestDb;Trusted_Connection=True;MultipleActiveResultSets=true;",
"Key": {
"Type": "Development"
},
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
Azure DevOps 是否已包含 localdb?
Does Azure DevOps already contain the localdb?
答案是肯定的。
windows 映像包含 localdb。 hosted windows agent 附带 Visual Studio,其中包括 LocalDB。
您可以使用以下启动命令来验证:
pool:
vmImage: 'windows-latest'
- task: PowerShell@2
displayName: 'start mssqllocaldb'
inputs:
targetType: 'inline'
script: 'sqllocaldb start mssqllocaldb'
测试结果: