I am currently working on an ASP.NET Core 2.0 Web API with EF Core 2.0. I plan to implement the Repository + UnitOfWork pattern and I've already created the abstractions, interfaces etc. Since I'm following a TDD approach I want to write tests on those interfaces before proceeding with the implementation.
The issue I'm facing is mostly related to semantics. I have created two projects in my solution, one for Unit Tests and one for Integration Tests. It's obvious to me that a test that also tests the database is not a unit test and should therefore be placed in the IntegrationTests project. The thing is though, that I am planning on using the EntityFrameworkCore.InMemory provider and boot up a fake in memory database for each test.
So every test should have this structure:
[TestClass]
public class GamesRepositoryTest
{
AppDbContext _context;
IGamesRepository _repository;
public GamesRepositoryTest()
{
}
[TestInitialize]
public void Initialize()
{
DbContextOptionsBuilder<AppDbContext> builder = new DbContextOptionsBuilder<AppDbContext>().UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString());
_context = new AppDbContext(builder.Options);
_repository = new GamesRepository(_context);
}
[TestCleanup]
public void Cleanup()
{
_context.Database.EnsureDeleted();
}
}
So my question is, does EntityFrameworkCore.InMemory provide an adequate level of abstraction so that the above class can be considered a unit test or should I place it in the IntegrationTests project?