When called from a method controller method

public IEnumerable<Client> GetAllTest() { var clients = _db.Clients.AsNoTracking().ToArray(); return rep.Get(); } 

I get clients - the current status of the database table.

if this method is called from the test unit (I check it) - the clients are already different - the state of the table at the time when I experimented with clients a little earlier - deleted them.

Apparently in the tests the cache works, although AsNoTracking () prohibits the use of the cache. Why is this happening and how to get rid of it?

UPD Found out that this effect does not necessarily occur when calling a method from a test, but in general from any other project in a given solution.

  • And you precisely cling to the same DB? - tym32167
  • Yes, the base is the same - olegall Nov.
  • why don't you want to re-create the data context for each test? - tym32167
  • I do not know. that's right? - olegall
  • Well, did you remember to save changes to the database after you added / deleted data? - tym32167

0