本文整理汇总了C#中System.Version.ToLanguageVersion方法的典型用法代码示例。如果您正苦于以下问题:C# Version.ToLanguageVersion方法的具体用法?C# Version.ToLanguageVersion怎么用?C# Version.ToLanguageVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Version
的用法示例。
在下文中一共展示了Version.ToLanguageVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OneRefactorTest
private void OneRefactorTest(string newName, string caretText, FileInput[] inputs, Version version, bool preview, string error, ExpectedPreviewItem[] expected = null) {
Console.WriteLine("Replacing {0} with {1}", caretText, newName);
version = version ?? new Version(2, 7);
for (int loops = 0; loops < 2; loops++) {
var views = new List<PythonEditor>();
try {
var mainView = new PythonEditor(inputs[0].Input, version.ToLanguageVersion(), _vs, filename: inputs[0].Filename);
var analyzer = mainView.Analyzer;
views.Add(mainView);
var bufferTable = new Dictionary<string, ITextBuffer> {
{ inputs[0].Filename, mainView.CurrentSnapshot.TextBuffer }
};
foreach (var i in inputs.Skip(1)) {
var editor = new PythonEditor(i.Input, version.ToLanguageVersion(), _vs, mainView.Factory, analyzer, i.Filename);
views.Add(editor);
bufferTable[i.Filename] = editor.CurrentSnapshot.TextBuffer;
}
// test runs twice, one w/ original buffer, once w/ re-analyzed buffers.
if (loops == 1) {
// do it again w/ a changed buffer
mainView.Text = mainView.Text;
}
var caretPos = inputs[0].Input.IndexOf(caretText);
mainView.View.MoveCaret(new SnapshotPoint(mainView.CurrentSnapshot, caretPos));
var extractInput = new RenameVariableTestInput(newName, bufferTable, preview);
var previewChangesService = new TestPreviewChanges(expected);
new VariableRenamer(views[0].View.View, _vs.ServiceProvider).RenameVariable(extractInput, previewChangesService);
if (error != null) {
Assert.AreEqual(error, extractInput.Failure);
return;
}
Assert.IsNull(extractInput.Failure, "Unexpected error message: " + (extractInput.Failure ?? ""));
Assert.AreEqual(preview, previewChangesService.Previewed, preview ? "Changes were not previewed" : "Changes were previewed");
AssertUtil.ArrayEquals(inputs.Select(i => i.Output).ToList(), views.Select(v => v.Text).ToList());
} finally {
views.Reverse();
foreach (var v in views) {
v.Dispose();
}
}
}
}