public void TestFieldLikeEvent() { var eventSymbol = _widgetClass.GetMember <EventSymbol>("E"); Assert.Equal("E:Acme.Widget.E", eventSymbol.GetDocumentationCommentId()); Assert.Equal("M:Acme.Widget.add_E(System.Action)", eventSymbol.AddMethod.GetDocumentationCommentId()); Assert.Equal("M:Acme.Widget.remove_E(System.Action)", eventSymbol.RemoveMethod.GetDocumentationCommentId()); }
private static void CheckInstanceAndStaticEvents(NamedTypeSymbol @class, string eventTypeDisplayString) { var instanceEvent = @class.GetMember <EventSymbol>("InstanceEvent"); Assert.Equal(SymbolKind.Event, instanceEvent.Kind); Assert.False(instanceEvent.IsStatic); Assert.Equal(eventTypeDisplayString, instanceEvent.Type.ToTestDisplayString()); CheckAccessorShape(instanceEvent.AddMethod, instanceEvent); CheckAccessorShape(instanceEvent.RemoveMethod, instanceEvent); var staticEvent = @class.GetMember <EventSymbol>("StaticEvent"); Assert.Equal(SymbolKind.Event, staticEvent.Kind); Assert.True(staticEvent.IsStatic); Assert.Equal(eventTypeDisplayString, staticEvent.Type.ToTestDisplayString()); CheckAccessorShape(staticEvent.AddMethod, staticEvent); CheckAccessorShape(staticEvent.RemoveMethod, staticEvent); }