on my mocked context I have the following:
var mockContext = new Mock<DbContext>();
mockContext.Setup(c => c.Set<Track>()).Returns(mockSet.Object);
an when I try to create mocked object for my repository I use the following code
EfRepository<Track> _efTrackRepository = new EfRepository<Shelf>(mockContext);
and I get the following error, is there any way I can solve this out?
error:
Argument 1: cannot convert from 'Moq.Mock<System.Data.Entity.DbContext>' to 'System.Data.Entity.DbContext'
You should use mockContext.Object
//
// Summary:
// Exposes the mocked object instance.
public virtual T Object { get; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With