Skip to content

Commit

Permalink
Property setups are ignored on mocks instantiated using Mock.Of
Browse files Browse the repository at this point in the history
  • Loading branch information
stakx committed Feb 13, 2022
1 parent 611652c commit a0243cd
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/Moq.Tests/Regressions/IssueReportsFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3549,6 +3549,36 @@ public interface IMockObject

#endregion

#region 1066

public class Issue1066
{
public interface IX
{
int Property { get; set; }
}

[Fact]
public void Stubbed_property_set_before_SetupGet()
{
var mock = Mock.Get(Mock.Of<IX>());
mock.Object.Property = 4;
mock.SetupGet(m => m.Property).Returns(3);
Assert.Equal(3, mock.Object.Property);
}

[Fact]
public void Stubbed_property_set_after_SetupGet()
{
var mock = Mock.Get(Mock.Of<IX>());
mock.SetupGet(m => m.Property).Returns(3);
mock.Object.Property = 4;
Assert.Equal(3, mock.Object.Property);
}
}

#endregion

#region 1071

public class Issue1071
Expand Down

0 comments on commit a0243cd

Please sign in to comment.