Skip to content

Commit

Permalink
Add regression test for subscribing to & raising redeclared event
Browse files Browse the repository at this point in the history
  • Loading branch information
stakx committed Aug 2, 2022
1 parent 4ab6ce1 commit 1b5ab84
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/Moq.Tests/Regressions/IssueReportsFixture.cs
Expand Up @@ -3688,6 +3688,38 @@ public virtual void SecondCall()

#endregion

#region 1175

public class Issue1175
{
[Fact]
public void Can_subscribe_to_and_raise_redeclared_event()
{
var handled = false;

var mock = new Mock<IDerived>();
mock.Setup(x => x.RaiseEvent()).Raises(x => x.Event += null, false);
mock.Object.Event += _ => handled = true;

mock.Object.RaiseEvent();

Assert.True(handled);
}

public interface IBase
{
event Action Event;
void RaiseEvent();
}

public interface IDerived : IBase
{
new event Action<bool> Event;
}
}

#endregion

#region 1217

public class Issue1217
Expand Down

0 comments on commit 1b5ab84

Please sign in to comment.