dimanche 24 juillet 2016

Targeting different Profiles during Testing

I have a launchsettings.json file in my ASP.Net Core project with a few different profiles, two of which let me toggle between using SQL Server and Sqlite.

"Windows: Dev - Sql Server": {
  "commandName": "Project",
  "environmentVariables": {
    "StorageProvider": "MSSQLServer",
    "ASPNETCORE_ENVIRONMENT": "Development"
  }
},
"Windows: Dev - Sqlite": {
  "commandName": "Project",
  "environmentVariables": {
    "StorageProvider": "Sqlite",
    "ASPNETCORE_ENVIRONMENT": "Development"
  }
},

I'd like to run my integration tests against both profiles, so that I can make sure my data store provider abstraction layer works properly for both data stores. How would I go about running my integration tests, which are just NUnit tests, under a given profile? I was reading an existing answer but it's not applicable to me. I don't want to hard-code my desired profile/environments in the tests. They need to be configurable so that I can run the tests during automated builds.

Thanks

Aucun commentaire:

Enregistrer un commentaire