1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
7
using ICSharpCode.NRefactory.Parser;
8
using ICSharpCode.NRefactory.Ast;
10
namespace ICSharpCode.NRefactory.Tests.Ast
13
public class CustomEventTests
16
// No C# representation
21
public void VBNetCustomEventsStatementTest()
23
string code = @" Public Custom Event TestEvent As EventHandler
24
AddHandler(ByVal value As EventHandler)
25
Handlers = CType([Delegate].Combine(Handlers, value), _
29
RemoveHandler(ByVal value as EventHandler)
30
Handlers = CType([Delegate].Remove(Handlers, value), _
34
RaiseEvent(ByVal sender As Object, ByVal e As EventArgs)
35
Dim TempHandlers As EventHandler = Handlers
37
If TempHandlers IsNot Nothing Then
38
TempHandlers(sender, e)
42
EventDeclaration customEventDecl = ParseUtilVBNet.ParseTypeMember<EventDeclaration>(code);
43
Assert.IsNotNull(customEventDecl);
44
Assert.AreEqual("TestEvent", customEventDecl.Name);