public void NameArgNull() { var csharp = new CSharpHelper(); Assert.Throws <ArgumentNullException>("type", () => { csharp.AppendNameTo(default(Type), new StringBuilder()); }); Assert.Throws <ArgumentNullException>("typeName", () => { csharp.AppendNameTo(typeof(int), default(StringBuilder)); }); Assert.Throws <ArgumentNullException>("type", () => { csharp.NameOf(default(Type)); }); }
protected void AppendNameTo(string expected, Type type) { var csharp = new CSharpHelper(); csharp.Import("System"); csharp.Import("System.Threading"); var typeName = new StringBuilder(type.Name.Length); csharp.AppendNameTo(type, typeName); Assert.Equal(expected, typeName.ToString()); typeName.Clear(); csharp.AppendNameTo(type, typeName); Assert.Equal(expected, typeName.ToString()); }