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

Latest version breaks interface mocks when property overridden in derived interface #162

Closed
abe545 opened this issue Mar 16, 2015 · 2 comments

Comments

@abe545
Copy link

abe545 commented Mar 16, 2015

This was working in 4.2.1409.1722 , but is broken in 4.2.1502.911.

It is a fairly complex setup, but the idea is that you have a derived interface that wants to add a set method to an existing read-only property on the base interface:

public interface A 
{
    decimal? Value { get; }
}

public interface B : A
{
    new decimal? Value { get; set; }
}

You used to be able to create a mock like this:

var i = Mock.Of<B>(b => b.Value == .14M);

And i.Value would be 0.14.
But now i.Value will be null.

@stakx
Copy link
Contributor

stakx commented Jun 20, 2017

This change has been introduced by commit 97a0f14. Looking at it now, but I'm not sure yet what can or should be done here.

@stakx
Copy link
Contributor

stakx commented Jun 20, 2017

Fixed in Moq 4.7.58.

@stakx stakx closed this as completed Jun 20, 2017
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

No branches or pull requests

2 participants