public void TestInspectorCase2 () { var input = @"using System; class Foo { void Bar (string str) { } }"; TestRefactoringContext context; var issueProvider = new RedundantUsingDirectiveIssue (); issueProvider.NamespacesToKeep.Add("System"); var issues = GetIssues (issueProvider, input, out context); Assert.AreEqual (0, issues.Count); }
public void TestInspectorCase2() { var input = @"using System; class Foo { void Bar (string str) { } }"; TestRefactoringContext context; var issueProvider = new RedundantUsingDirectiveIssue(); issueProvider.NamespacesToKeep.Add("System"); var issues = GetIssues(issueProvider, input, out context); Assert.AreEqual(0, issues.Count); }
string RemoveUsings(string buffer) { var content = _bufferParser.ParsedContent(buffer, _fileName); var tree = content.SyntaxTree; var firstUsing = tree.Children.FirstOrDefault(IsUsingDeclaration); if (firstUsing != null) { var request = CreateRequest(buffer, firstUsing); var context = OmniSharpRefactoringContext.GetContext(_bufferParser, request); var redundantUsings = new RedundantUsingDirectiveIssue().GetIssues(context, null); if (redundantUsings.Any()) { var actions = redundantUsings.First().Actions; buffer = RunActions(context, actions); } } return(buffer); }
string RemoveUsings(string buffer) { var content = _bufferParser.ParsedContent(buffer, _fileName); var tree = content.SyntaxTree; var firstUsing = tree.Children.FirstOrDefault(IsUsingDeclaration); if (firstUsing != null) { var request = CreateRequest(buffer, firstUsing); var context = OmniSharpRefactoringContext.GetContext(_bufferParser, request); var redundantUsings = new RedundantUsingDirectiveIssue().GetIssues(context, null); if (redundantUsings.Any()) { var actions = redundantUsings.First().Actions; buffer = RunActions(context, actions); } } return buffer; }