private static CodeAction FindAction(List <CodeAction> actions, string fixTitle) { if (fixTitle != null) { if (actions.All(x => x.Title != fixTitle)) { var errorBuilder = StringBuilderPool.Borrow(); errorBuilder.AppendLine($"Did not find a code fix with title {fixTitle}.").AppendLine("Found:"); foreach (var codeAction in actions) { errorBuilder.AppendLine(codeAction.Title); } throw AssertException.Create(StringBuilderPool.Return(errorBuilder)); } actions.RemoveAll(x => x.Title != fixTitle); } if (actions.Count == 0) { throw AssertException.Create("Expected one code fix, was 0."); } if (actions.Count > 1) { throw AssertException.Create($"Expected only one code fix, found {actions.Count}:\r\n" + $"{string.Join("\r\n", actions.Select(x => x.Title))}\r\n" + "Use the overload that specifies title."); } return(actions[0]); }
public string Return() { return(StringBuilderPool.Return(this)); }
internal string Return() { return(StringBuilderPool.Return(this)); }