-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c25305
commit 043c99d
Showing
2 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...alyzer-dotnet/tests/SonarAnalyzer.UnitTest/TestCases/UninvokedEventDeclaration.CSharp9.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
|
||
public record EventInvocations | ||
{ | ||
public event EventHandler MyEvent1; | ||
public event EventHandler MyEvent2; | ||
public event EventHandler MyEvent3; | ||
public event EventHandler MyEvent4; | ||
public event EventHandler MyEvent5; | ||
public event EventHandler MyEvent6; | ||
|
||
public event Action<object, EventArgs> MyAction1; | ||
public event Action<object, EventArgs> MyAction2; | ||
public event Action<object, EventArgs> MyAction3; | ||
public event Action<object, EventArgs> MyAction4; | ||
public event Action<object, EventArgs> MyAction5; | ||
public event Action<object, EventArgs> MyAction6; | ||
|
||
public void InvokeAll() | ||
{ | ||
MyEvent1(this, EventArgs.Empty); | ||
MyEvent2.Invoke(this, EventArgs.Empty); | ||
MyEvent3.DynamicInvoke(this, EventArgs.Empty); | ||
MyEvent4.BeginInvoke(this, EventArgs.Empty, null, null); | ||
this.MyEvent5(this, EventArgs.Empty); | ||
MyEvent6?.Invoke(this, EventArgs.Empty); | ||
|
||
MyAction1(this, EventArgs.Empty); | ||
MyAction2.Invoke(this, EventArgs.Empty); | ||
MyAction3.DynamicInvoke(this, EventArgs.Empty); | ||
MyAction4.BeginInvoke(this, EventArgs.Empty, null, null); | ||
this.MyAction5(this, EventArgs.Empty); | ||
MyAction6?.Invoke(this, EventArgs.Empty); | ||
} | ||
} |