public async Task EventHookupRemovesInaccessibleAttributes() { var workspaceXml = @" <Workspace> <Project Language=""C#"" AssemblyName=""A"" CommonReferences=""true""> <Document> using System; public static class C { public static event DelegateType E; public delegate void DelegateType([ShouldBeRemovedInternalAttribute] object o); } internal class ShouldBeRemovedInternalAttribute : Attribute { } </Document> </Project> <Project Language=""C#"" CommonReferences=""true""> <ProjectReference>A</ProjectReference> <Document> class D { void M() { C.E +$$ } }</Document> </Project> </Workspace>"; using var testState = new EventHookupTestState( XElement.Parse(workspaceXml), options: null ); testState.SendTypeChar('='); testState.SendTab(); await testState.WaitForAsynchronousOperationsAsync(); var expectedCode = @" class D { void M() { C.E += C_E; } private void C_E(object o) { throw new System.NotImplementedException(); } }"; testState.AssertCodeIs(expectedCode); }
public async Task HandlerName_EventInThisClass_CamelCaseRule() { var markup = @" class C { event System.Action MyEvent; void M() { MyEvent +$$ } }"; using var testState = new EventHookupTestState( EventHookupTestState.GetWorkspaceXml(markup), _namingOptions.MethodNamesAreCamelCase); testState.SendTypeChar('='); await testState.WaitForAsynchronousOperationsAsync(); testState.AssertShowing("c_MyEvent"); }