Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added method for build DbSet from IEnumerable. #75

Merged
merged 2 commits into from
Mar 7, 2024

Conversation

sq735
Copy link
Contributor

@sq735 sq735 commented Feb 26, 2024

PR Details

Added a method that allows you to create a DbSet<T> from an IEnumerable<T>.

Description

Often, when performing testing, to create a DbSet<T> from a collection, it was necessary to call the AsQueryable() then BuildMockDbSet() methods. For example:

var users = new List<User>();
DbSet<User> dbSet = users.AsQueryable().BuildMockDbSet();

This improvement allows you to create a DbSet<T> right away. For example:

var users = new List<User>();
DbSet<User> dbSet = users.BuildMockDbSet();

@romantitov
Copy link
Owner

Hi @sq735. Thanks for your effort. I will include the improvement to the next release.

@romantitov romantitov merged commit d48cbb1 into romantitov:master Mar 7, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants