public void ExtractMethod7() { SelectionResultConfiguration.Set(1, 1); const string test = @" using System; using System.Collections.Generic; using System.Linq; class Program { int field; void Test(string[] args) { int i = 10; field = i; } }"; var expected = new DiagnosticResult { Id = DiagnosticIdentifiers.ExtractMethod, Message = DiagnosticDescriptors.ExtractMethod.MessageFormat.ToString(), Severity = DiagnosticSeverity.Hidden, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 9, 5) } }; VerifyCSharpDiagnostic(test, expected); var fixtests = new[] { @" using System; using System.Collections.Generic; using System.Linq; class Program { int field; void Test(string[] args) { int i = 10; Test_ExtractedMethod(i); } private void Test_ExtractedMethod(int i) { field = i; } }" }; VerifyCSharpFix(test, fixtests, null, true); }
public static void Set(int lineStart, int depth) { _instance = new SelectionResultConfiguration(lineStart, depth); }