protected void FullNameOf(string expected, Type type) { var csharp = new CSharpHelper(); csharp.Import("System"); csharp.Import("System.Threading"); Assert.Equal(expected, csharp.FullNameOf(type)); Assert.Equal(expected, csharp.FullNameOf(type)); }
public void GenericParameterTypeName() { var parameters = typeof(Func <, , , ,>).GetTypeInfo().GenericTypeParameters; var csharp = new CSharpHelper(); Assert.Equal("T1", csharp.AliasNameOf(parameters[0])); Assert.Equal("T2", csharp.CRefNameOf(parameters[1])); Assert.Equal("T3", csharp.FullNameOf(parameters[2])); Assert.Equal("T4", csharp.NameOf(parameters[3])); Assert.Equal(string.Empty, csharp.TypeOfNameOf(parameters[4])); }
public void FullNameArgNull() { var csharp = new CSharpHelper(); Assert.Throws <ArgumentNullException>("type", () => { csharp.AppendFullNameTo(default(Type), new StringBuilder()); }); Assert.Throws <ArgumentNullException>("typeName", () => { csharp.AppendFullNameTo(typeof(int), default(StringBuilder)); }); Assert.Throws <ArgumentNullException>("type", () => { csharp.FullNameOf(default(Type)); }); }