提交 5aa50bba 编写于 作者: S Sam Harwell

Avoid making changes to production code to avoid approval overhead

上级 eac45765
......@@ -16,7 +16,7 @@ internal abstract class FixSomeCodeAction : CodeAction
private static readonly HashSet<string> s_predefinedCodeFixProviderNames = GetPredefinedCodeFixProviderNames();
internal readonly FixAllState FixAllState;
private bool _showPreviewChangesDialog;
private readonly bool _showPreviewChangesDialog;
internal FixSomeCodeAction(
FixAllState fixAllState, bool showPreviewChangesDialog)
......@@ -84,28 +84,5 @@ private static HashSet<string> GetPredefinedCodeFixProviderNames()
return names;
}
internal TestAccessor GetTestAccessor()
{
return new TestAccessor(this);
}
internal readonly struct TestAccessor
{
private readonly FixSomeCodeAction _fixSomeCodeAction;
internal TestAccessor(FixSomeCodeAction fixSomeCodeAction)
{
_fixSomeCodeAction = fixSomeCodeAction;
}
/// <summary>
/// Gets a reference to <see cref="_showPreviewChangesDialog"/>, which can be read or written by test code.
/// </summary>
public ref bool ShowPreviewChangesDialog
{
get => ref _fixSomeCodeAction._showPreviewChangesDialog;
}
}
}
}
......@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
......@@ -386,8 +387,8 @@ private void BeginInvokeExecuteOnActiveView(Action<IWpfTextView> action)
// Ensure the preview changes dialog will not be shown. Since the operation 'willBlockUntilComplete',
// the caller would not be able to interact with the preview changes dialog, and the tests would
// either timeout or deadlock.
fixSomeCodeAction.GetTestAccessor().ShowPreviewChangesDialog = false;
var field = typeof(FixSomeCodeAction).GetField("_showPreviewChangesDialog", BindingFlags.Instance | BindingFlags.NonPublic);
field.SetValue(fixSomeCodeAction, false);
}
if (string.IsNullOrEmpty(actionName))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册