-
-
Notifications
You must be signed in to change notification settings - Fork 794
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
Moq.SetupGet doesn't work with Mock.Of<> #526
Comments
I cannot reproduce that issue given Moq 4.7.145, your test code, and a straightforward definition for public interface EntityConnection
{
string ConnectionString { get; set; }
} Could you please update your repro code to be minimally complete (i.e. include the relevant parts of the type that you're mocking), and make sure it reproduces the issue you're describing? |
I could reproduce the problem with the following type definition: public abstract class DbConnection
{
public abstract string ConnectionString { get; set; }
}
public class EntityConnection : DbConnection
{
public override string ConnectionString { get; set; }
} I can confirm that this issue has already been fixed in the |
When a mock is created with new Mock<>, a getter can be modified with SetupGet.
When a mock is created with Mock.Of<>, SetupGet doesn't seem to work.
Code sample :
I'm using nuget 4.7.145
The text was updated successfully, but these errors were encountered: