未验证 提交 8c616583 编写于 作者: J Joey Robichaud 提交者: GitHub

Merge pull request #39638 from JoeRobich/fix-test-strings

Use resource strings for validating warning text
......@@ -1681,20 +1681,18 @@ class C
}", safe: true, useSymbolAnnotations);
var doc = await GetDocument(source, useSymbolAnnotations);
OptionSet options = await doc.GetOptionsAsync();
var imported = await ImportAdder.AddImportsFromSyntaxesAsync(doc, true, options);
var root = await imported.GetSyntaxRootAsync();
var nodeWithWarning = root.GetAnnotatedNodes(WarningAnnotation.Kind).Single();
Assert.Equal("42.M", nodeWithWarning.ToFullString());
var warning = nodeWithWarning.GetAnnotations(WarningAnnotation.Kind).Single();
var expectedWarningMessage = string.Format(WorkspacesResources.Warning_adding_imports_will_bring_an_extension_method_into_scope_with_the_same_name_as_member_access, "M");
Assert.Equal("Adding imports will bring an extension method into scope with the same name as 'M'", WarningAnnotation.GetDescription(warning));
Assert.Equal(expectedWarningMessage, WarningAnnotation.GetDescription(warning));
}
#endregion
}
......
......@@ -1433,14 +1433,20 @@ Friend Class C
Return AddressOf 42.M
End Function
End Class", safe:=True, useSymbolAnnotations)
Dim doc = Await GetDocument(source, useSymbolAnnotations)
Dim options As OptionSet = Await doc.GetOptionsAsync()
Dim imported = Await ImportAdder.AddImportsFromSyntaxesAsync(doc, True, options)
Dim root = Await imported.GetSyntaxRootAsync()
Dim nodeWithWarning = root.GetAnnotatedNodes(WarningAnnotation.Kind).Single()
Assert.Equal("42.M" & vbCrLf, nodeWithWarning.ToFullString())
Dim warning = nodeWithWarning.GetAnnotations(WarningAnnotation.Kind).Single()
Assert.Equal("Adding imports will bring an extension method into scope with the same name as 'M'", WarningAnnotation.GetDescription(warning))
Dim expectedWarningMessage = String.Format(WorkspacesResources.Warning_adding_imports_will_bring_an_extension_method_into_scope_with_the_same_name_as_member_access, "M")
Assert.Equal(expectedWarningMessage, WarningAnnotation.GetDescription(warning))
End Function
#End Region
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册