huysentruitw / entity-framework-core-mock

Easy Mock wrapper for mocking EFCore5 DbContext and DbSet using Moq or NSubstitute

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why does DbContextMock.Object.Entry(entry) return null

mzmoosa01 opened this issue · comments

Context

I'm trying to test a Put method and when the DbContextMock.Object.Entry(entry) seems to always return null

Recreating the issue

  • Create a mocked dbContext
  • Populate the mocked dbContext with entities
  • Attempt to retrieve one of the entities using DbContextMock.Object.Entry(entry)
  • This will return null

I'm not sure if this is expected or if I'm doing something wrong perhaps.

Thank you for the response.