entity-framework-core-mock icon indicating copy to clipboard operation
entity-framework-core-mock copied to clipboard

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

Results 7 entity-framework-core-mock issues
Sort by recently updated
recently updated
newest added

`DbContextMock.CreateDbSetMock` has the following line: ``` if (_dbSetCache.ContainsKey(entityType)) throw new ArgumentException($"DbSetMock for entity {entityType.Name} already created", nameof(dbSetSelector)); ``` which effectively shuts off any attempt to override an existing set. There...

Currently, when using EF7 ExecuteUpdateAsync or ExecuteDeleteAsync, it will fail that given method is not found. Reason is, that internally EntityRewriter visitor will change type from IQueryable to IEnumerable and...

I have encountered an Issue, when an int or long key property is used and the MockDbSet has initial Entities with predefined key values. This PR also includes a test...

It took me some time to find out why the async add was not working on datacontext, while the code of this lib showed it should be straight forward handeld....

I have a class with [PrimaryKey attribute](https://learn.microsoft.com/en-us/ef/core/modeling/keys?tabs=data-annotations#configuring-a-primary-key) for a composite key. I see in the documentation that composite keys should work with multiple `Key` and `Order` attributes. _Primary key on...

Properties linked to related tables via foreign key don't seem to be populated I have ``` var query = from u in dbContext.Users where u.Id == userId select u.IsMaster ||...

Update to dotnet 9.0 but added other frameworks to continue supporting older frameworks and EF versions. Updated dependencies and relaxed versions to be more flexible. No code changes and tests...