84 references to GetTypeName
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ResultProvider.UnitTests (84)
TypeNameFormatterTests.cs (84)
25Assert.Equal("object", typeof(object).GetTypeName());
26Assert.Equal("bool", typeof(bool).GetTypeName());
27Assert.Equal("char", typeof(char).GetTypeName());
28Assert.Equal("sbyte", typeof(sbyte).GetTypeName());
29Assert.Equal("byte", typeof(byte).GetTypeName());
30Assert.Equal("short", typeof(short).GetTypeName());
31Assert.Equal("ushort", typeof(ushort).GetTypeName());
32Assert.Equal("int", typeof(int).GetTypeName());
33Assert.Equal("uint", typeof(uint).GetTypeName());
34Assert.Equal("long", typeof(long).GetTypeName());
35Assert.Equal("ulong", typeof(ulong).GetTypeName());
36Assert.Equal("float", typeof(float).GetTypeName());
37Assert.Equal("double", typeof(double).GetTypeName());
38Assert.Equal("decimal", typeof(decimal).GetTypeName());
39Assert.Equal("string", typeof(string).GetTypeName());
70Assert.Equal("A", assembly.GetType("A").GetTypeName());
71Assert.Equal("A.B", assembly.GetType("A+B").GetTypeName());
72Assert.Equal("N.A", assembly.GetType("N.A").GetTypeName());
73Assert.Equal("N.A.B", assembly.GetType("N.A+B").GetTypeName());
74Assert.Equal("N.G1<int>.G2<float>.G3<double>", assembly.GetType("N.G1`1+G2`1+G3`1").MakeGenericType(typeof(int), typeof(float), typeof(double)).GetTypeName());
75Assert.Equal("N.G1<int>.G2<float>.G4<double, ushort>", assembly.GetType("N.G1`1+G2`1+G4`2").MakeGenericType(typeof(int), typeof(float), typeof(double), typeof(ushort)).GetTypeName());
106Assert.Equal("N.C<T, U>", typeC.GetTypeName());
107Assert.Equal("N.C<int, string>", typeCIntString.GetTypeName());
108Assert.Equal("N.C<A, A.B>", typeC.MakeGenericType(typeA, typeB).GetTypeName());
109Assert.Equal("N.C<int, string>.D<A, A.B>", typeD.MakeGenericType(typeInt, typeString, typeA, typeB).GetTypeName());
110Assert.Equal("N.C<A, N.C<int, string>>.D<N.C<int, string>, A.B>", typeD.MakeGenericType(typeA, typeCIntString, typeCIntString, typeB).GetTypeName());
126Assert.Equal("A<int>.B", typeB.MakeGenericType(typeof(int)).GetTypeName());
132Assert.Equal("int?", typeof(int?).GetTypeName());
133Assert.Equal("bool?", typeof(bool?).GetTypeName());
161Assert.Equal("N.C?", typeNullable.MakeGenericType(typeC).GetTypeName());
162Assert.Equal("N.A<N.C>?", typeNullable.MakeGenericType(typeA.MakeGenericType(typeC)).GetTypeName());
163Assert.Equal("N.A<N.C>.B<N.C>?", typeNullable.MakeGenericType(typeB.MakeGenericType(typeC, typeC)).GetTypeName());
169Assert.Equal("int[]", typeof(int[]).GetTypeName());
170Assert.Equal("int[,]", typeof(int[,]).GetTypeName());
171Assert.Equal("int[][,]", typeof(int[][,]).GetTypeName());
172Assert.Equal("int[,][]", typeof(int[,][]).GetTypeName());
200Assert.Equal("N.C[]", typeC.MakeArrayType().GetTypeName());
201Assert.Equal("N.C[]", typeC.MakeArrayType(1).GetTypeName()); // NOTE: Multi-dimensional array that happens to exactly one dimension.
202Assert.Equal("N.A<N.C>[,]", typeA.MakeGenericType(typeC).MakeArrayType(2).GetTypeName());
203Assert.Equal("N.A<N.C[]>.B<N.C>[,,]", typeB.MakeGenericType(typeC.MakeArrayType(), typeC).MakeArrayType(3).GetTypeName());
211Assert.Equal("int[,,]", instance.GetType().GetTypeName());
212Assert.Equal("int[][,,]", instance.GetType().MakeArrayType().GetTypeName());
218Assert.Equal("int*", typeof(int).MakePointerType().GetTypeName());
219Assert.Equal("int**", typeof(int).MakePointerType().MakePointerType().GetTypeName());
220Assert.Equal("int*[]", typeof(int).MakePointerType().MakeArrayType().GetTypeName());
246Assert.Equal("N.C*", typeC.MakePointerType().GetTypeName());
247Assert.Equal("N.A<N.C>*", typeA.MakeGenericType(typeC).MakePointerType().GetTypeName());
248Assert.Equal("N.A<N.C>.B<N.C>*", typeB.MakeGenericType(typeC, typeC).MakePointerType().GetTypeName());
254Assert.Equal("void", typeof(void).GetTypeName());
255Assert.Equal("void*", typeof(void).MakePointerType().GetTypeName());
290Assert.Equal("object", objectType.GetTypeName(escapeKeywordIdentifiers: false));
291Assert.Equal("object.true", trueType.GetTypeName(escapeKeywordIdentifiers: false));
292Assert.Equal("return.false.null", nullType.GetTypeName(escapeKeywordIdentifiers: false));
293Assert.Equal("return.yield<async>", yieldType.GetTypeName(escapeKeywordIdentifiers: false));
294Assert.Equal("return.yield<return.false.null>", constructedYieldType.GetTypeName(escapeKeywordIdentifiers: false));
295Assert.Equal("return.yield<return.false.null>.await", constructedAwaitType.GetTypeName(escapeKeywordIdentifiers: false));
297Assert.Equal("@object", objectType.GetTypeName(escapeKeywordIdentifiers: true));
298Assert.Equal("@object.@true", trueType.GetTypeName(escapeKeywordIdentifiers: true));
299Assert.Equal("@return.@false.@null", nullType.GetTypeName(escapeKeywordIdentifiers: true));
300Assert.Equal("@return.@yield<@async>", yieldType.GetTypeName(escapeKeywordIdentifiers: true));
301Assert.Equal("@return.@yield<@return.@false.@null>", constructedYieldType.GetTypeName(escapeKeywordIdentifiers: true));
302Assert.Equal("@return.@yield<@return.@false.@null>.@await", constructedAwaitType.GetTypeName(escapeKeywordIdentifiers: true));
309Assert.Equal("dynamic", typeof(object).GetTypeName(MakeCustomTypeInfo(attributes), escapeKeywordIdentifiers: false));
310Assert.Equal("dynamic", typeof(object).GetTypeName(MakeCustomTypeInfo(attributes), escapeKeywordIdentifiers: true));
317Assert.Equal("dynamic", typeof(object).GetTypeName(MakeCustomTypeInfo(true)));
320Assert.Equal("dynamic[]", typeof(object[]).GetTypeName(MakeCustomTypeInfo(false, true)));
321Assert.Equal("dynamic[][]", typeof(object[][]).GetTypeName(MakeCustomTypeInfo(false, false, true)));
324Assert.Equal("System.Func<dynamic>", typeof(Func<object>).GetTypeName(MakeCustomTypeInfo(false, true)));
347Assert.Equal("N.A<object>.B<dynamic>", typeBConstructed.GetTypeName(MakeCustomTypeInfo(false, false, true)));
348Assert.Equal("N.A<dynamic>.B<object>", typeBConstructed.GetTypeName(MakeCustomTypeInfo(false, true, false)));
349Assert.Equal("N.A<dynamic>.B<dynamic>[]", typeBConstructed.MakeArrayType().GetTypeName(MakeCustomTypeInfo(false, false, true, true)));
356Assert.Equal("int", typeof(int).GetTypeName(MakeCustomTypeInfo(true)));
357Assert.Equal("dynamic[]", typeof(object[]).GetTypeName(MakeCustomTypeInfo(true, true)));
360Assert.Equal("dynamic", typeof(object).GetTypeName(MakeCustomTypeInfo(true, true)));
361Assert.Equal("object", typeof(object).GetTypeName(MakeCustomTypeInfo(false, true)));
364Assert.Equal("object[]", typeof(object[]).GetTypeName(MakeCustomTypeInfo(true)));
365Assert.Equal("object[]", typeof(object[]).GetTypeName(MakeCustomTypeInfo(false)));
368Assert.Equal("System.Func<object>", typeof(Func<object>).GetTypeName(MakeCustomTypeInfo(true)));
391Assert.Equal("N.A<object>.B<object>", typeBConstructed.GetTypeName(MakeCustomTypeInfo(false)));
392Assert.Equal("N.A<dynamic>.B<object>", typeBConstructed.GetTypeName(MakeCustomTypeInfo(false, true)));
393Assert.Equal("N.A<dynamic>.B<object>[]", typeBConstructed.MakeArrayType().GetTypeName(MakeCustomTypeInfo(false, false, true)));
400Assert.Equal("object", typeof(object).GetTypeName(typeInfo));
401Assert.Equal("object[]", typeof(object[]).GetTypeName(typeInfo));
426var typeName = type.GetTypeName();