The Moo
The Moo

Reputation: 503

Running Unit / Integration tests through an in-memory SQL database using Visual Studio Team Services

I'm trying to setup a CI Build Definition in visual studio team services that runs a number of tests. I currently have these tests setup with xUnit (as shown below).

Screenshot of a test

These tests use the Entity Framework's in-memory relational sql database. The test classes extend the below code and manipulate the database using the DbContext variable (see below).

Screenshot of dbcontext code

When the tests are run locally, they all pass and perform fine. When the build is run on the online CI platform, while the build succeeds using the hosted VS2017 agent, all of the tests fail due to the below error.

Screenshot of the error message

Other screenshot of the error message

We still wish to use the online hosted agents as an on-premisis agents (which I understand are a bit more configurable) won't necessarily be suitable.

Thanks in advance :)

Upvotes: 0

Views: 1308

Answers (1)

starian chen-MSFT
starian chen-MSFT

Reputation: 33698

Based on your code, you are using UserSqlServer method that is used for SQL database, you need to call UseInMemoryDatabase method.

Upvotes: 2

Related Questions