Completion\CompletionProviders\ExtensionMethodImportCompletionProviderTests.cs (111)
44foreach (var refKind in Enum.GetValues(typeof(ReferenceType)))
55=> (new[] { ReferenceType.None, ReferenceType.Project, ReferenceType.Metadata }).Select(refType => new[] { (object)refType });
80private static string GetMarkup(string current, string referenced, ReferenceType refType,
85ReferenceType.None => CreateMarkupForSingleProject(current, referenced, currentLanguage),
86ReferenceType.Project => GetMarkupWithReference(current, referenced, currentLanguage, referencedLanguage, true),
87ReferenceType.Metadata => GetMarkupWithReference(current, referenced, currentLanguage, referencedLanguage, false),
96public async Task TestPredefinedType(string type1, string type2, ReferenceType refType)
134public async Task UsingAliasInDeclaration(ReferenceType refType)
174public async Task UsingAliasInDeclaration_PrimitiveType(ReferenceType refType)
214public async Task UsingAliasInDeclaration_RegularType(ReferenceType refType)
254public async Task UsingAliasInDeclaration_GenericType(ReferenceType refType)
294public async Task UsingAliasInDeclaration_RegularTypeWithSameSimpleName(ReferenceType refType)
333public async Task UsingAliasInDeclaration_Namespace(ReferenceType refType)
374public async Task UsingAliasInUsage(ReferenceType refType)
414public async Task RegularType(string typeKind, ReferenceType refType)
453public async Task ObjectType(string typeKind, ReferenceType refType)
500public async Task ValueTupleType(string tupleType, ReferenceType refType)
539public async Task RegularTypeAsBase(string baseType, ReferenceType refType)
588public async Task BoundedGenericType(string type, ReferenceType refType)
635public async Task MatchingTypeParameter(string type, ReferenceType refType)
674[InlineData(ReferenceType.Project)]
675[InlineData(ReferenceType.Metadata)]
677public async Task TestInternalExtensionMethods_NoIVT_InReference(ReferenceType refType)
743var markup = GetMarkup(file2, file1, ReferenceType.None);
752[InlineData(ReferenceType.None)]
753[InlineData(ReferenceType.Project)]
755public async Task TestInternalExtensionMethods_WithIVT(ReferenceType refType)
792public async Task UserDefinedGenericType(ReferenceType refType)
863var markup = GetMarkup(file2, file1, ReferenceType.None);
930var markup = GetMarkup(file2, file1, ReferenceType.Project, currentLanguage: LanguageNames.CSharp, referencedLanguage: LanguageNames.VisualBasic);
1043var markup = GetMarkup(file2, file1, ReferenceType.None);
1093var markup = GetMarkup(file2, file1, ReferenceType.None);
1135var markup = GetMarkup(file2, file1, ReferenceType.None);
1172var markup = GetMarkup(file2, file1, ReferenceType.None);
1233[InlineData(ReferenceType.Project, "public")]
1234[InlineData(ReferenceType.Project, "internal")]
1235[InlineData(ReferenceType.Metadata, "public")] // We don't support internal extension method from non-source references.
1237public async Task TestExtensionMethodsInConflictingTypes(ReferenceType refType, string accessibility)
1276ReferenceType.Project => CreateMarkupForProjectWithProjectReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1277ReferenceType.Metadata => CreateMarkupForProjectWithMetadataReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1403[InlineData(ReferenceType.Project, "[]", "ExtentionMethod2")]
1404[InlineData(ReferenceType.Project, "[][]", "ExtentionMethod3")]
1405[InlineData(ReferenceType.Project, "[,]", "ExtentionMethod4")]
1406[InlineData(ReferenceType.Project, "[][,]", "ExtentionMethod5")]
1407[InlineData(ReferenceType.Metadata, "[]", "ExtentionMethod2")]
1408[InlineData(ReferenceType.Metadata, "[][]", "ExtentionMethod3")]
1409[InlineData(ReferenceType.Metadata, "[,]", "ExtentionMethod4")]
1410[InlineData(ReferenceType.Metadata, "[][,]", "ExtentionMethod5")]
1412public async Task TestExtensionMethodsForSimpleArrayType(ReferenceType refType, string rank, string expectedName)
1451ReferenceType.Project => CreateMarkupForProjectWithProjectReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1452ReferenceType.Metadata => CreateMarkupForProjectWithMetadataReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1463[InlineData(ReferenceType.Project, "[]", "ExtentionMethod2")]
1464[InlineData(ReferenceType.Project, "[][]", "ExtentionMethod3")]
1465[InlineData(ReferenceType.Project, "[,]", "ExtentionMethod4")]
1466[InlineData(ReferenceType.Project, "[][,]", "ExtentionMethod5")]
1467[InlineData(ReferenceType.Metadata, "[]", "ExtentionMethod2")]
1468[InlineData(ReferenceType.Metadata, "[][]", "ExtentionMethod3")]
1469[InlineData(ReferenceType.Metadata, "[,]", "ExtentionMethod4")]
1470[InlineData(ReferenceType.Metadata, "[][,]", "ExtentionMethod5")]
1472public async Task TestExtensionMethodsForGenericArrayType(ReferenceType refType, string rank, string expectedName)
1511ReferenceType.Project => CreateMarkupForProjectWithProjectReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1512ReferenceType.Metadata => CreateMarkupForProjectWithMetadataReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1524[InlineData(ReferenceType.Project)]
1525[InlineData(ReferenceType.Metadata)]
1527public async Task TestGenericReceiverTypeWithConstraint(ReferenceType refType)
1560ReferenceType.Project => CreateMarkupForProjectWithProjectReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1561ReferenceType.Metadata => CreateMarkupForProjectWithMetadataReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1572[InlineData(ReferenceType.Project, "(int,int)")]
1573[InlineData(ReferenceType.Project, "(int,int,int,int,int,int,int,int,int,int)")] // more than 8 tuple elements
1574[InlineData(ReferenceType.Metadata, "(int,int)")]
1575[InlineData(ReferenceType.Metadata, "(int,int,int,int,int,int,int,int,int,int)")] // more than 8 tuple elements
1577public async Task TestTupleArray(ReferenceType refType, string tupleType)
1603ReferenceType.Project => CreateMarkupForProjectWithProjectReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1604ReferenceType.Metadata => CreateMarkupForProjectWithMetadataReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1615[InlineData(ReferenceType.Project, "(int[],int[])")]
1616[InlineData(ReferenceType.Project, "(int[],int[],int[],int[],int[],int[],int[],int[],int[],int[])")] // more than 8 tuple elements
1617[InlineData(ReferenceType.Metadata, "(int[],int[])")]
1618[InlineData(ReferenceType.Metadata, "(int[],int[],int[],int[],int[],int[],int[],int[],int[],int[])")] // more than 8 tuple elements
1620public async Task TestArrayTuple(ReferenceType refType, string tupleType)
1646ReferenceType.Project => CreateMarkupForProjectWithProjectReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1647ReferenceType.Metadata => CreateMarkupForProjectWithMetadataReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1658[InlineData(ReferenceType.Project)]
1659[InlineData(ReferenceType.Metadata)]
1661public async Task TestDescriptionOfGenericReceiverType(ReferenceType refType)
1689ReferenceType.Project => CreateMarkupForProjectWithProjectReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1690ReferenceType.Metadata => CreateMarkupForProjectWithMetadataReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1703[InlineData(ReferenceType.Project)]
1704[InlineData(ReferenceType.Metadata)]
1706public async Task TestDescriptionOfOverloads(ReferenceType refType)
1739ReferenceType.Project => CreateMarkupForProjectWithProjectReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1740ReferenceType.Metadata => CreateMarkupForProjectWithMetadataReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1760[InlineData(ReferenceType.Project)]
1761[InlineData(ReferenceType.Metadata)]
1763public async Task TestBrowsableAlways(ReferenceType refType)
1794ReferenceType.Project => CreateMarkupForProjectWithProjectReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1795ReferenceType.Metadata => CreateMarkupForProjectWithMetadataReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp),
1806[InlineData(ReferenceType.Project)]
1807[InlineData(ReferenceType.Metadata)]
1809public async Task TestBrowsableNever(ReferenceType refType)
1840ReferenceType.Project => (CreateMarkupForProjectWithProjectReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp), true),
1841ReferenceType.Metadata => (CreateMarkupForProjectWithMetadataReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp), false),
1862[InlineData(ReferenceType.Project, true)]
1863[InlineData(ReferenceType.Project, false)]
1864[InlineData(ReferenceType.Metadata, true)]
1865[InlineData(ReferenceType.Metadata, false)]
1867public async Task TestBrowsableAdvanced(ReferenceType refType, bool hideAdvanced)
1900(ReferenceType.Project, _) => (CreateMarkupForProjectWithProjectReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp), true),
1901(ReferenceType.Metadata, true) => (CreateMarkupForProjectWithMetadataReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp), false),
1902(ReferenceType.Metadata, false) => (CreateMarkupForProjectWithMetadataReference(srcDoc, refDoc, LanguageNames.CSharp, LanguageNames.CSharp), true),