huysentruitw / entity-framework-core-mock

Easy Mock wrapper for mocking EFCore5 DbContext and DbSet using Moq or NSubstitute
MIT License
132 stars 24 forks source link

Handle property with a protected setter #27

Closed gabrielrobert closed 3 years ago

gabrielrobert commented 3 years ago

We had an issue mocking a DbContext with models containing a property with a protected setter. For example:

public class Entity
{
    public DateTime CreationDate { get; protected set; }

    protected Entity()
    {
        CreationDate = DateTime.UtcNow;
    }
}
huysentruitw commented 3 years ago

Now, this is how PR's should look like! Well done & thanks. 🎉