Example #1
0
        public void AliasNameArgNull()
        {
            var csharp = new CSharpHelper();

            Assert.Throws <ArgumentNullException>("type",
                                                  () => { csharp.AppendAliasNameTo(default(Type), new StringBuilder()); });
            Assert.Throws <ArgumentNullException>("typeName",
                                                  () => { csharp.AppendAliasNameTo(typeof(int), default(StringBuilder)); });
            Assert.Throws <ArgumentNullException>("type",
                                                  () => { csharp.AliasNameOf(default(Type)); });
        }
Example #2
0
        protected void AppendAliasNameTo(string expected, Type type)
        {
            var csharp = new CSharpHelper();

            csharp.Import("System");
            csharp.Import("System.Threading");
            var typeName = new StringBuilder(type.FullName.Length);

            csharp.AppendAliasNameTo(type, typeName);
            Assert.Equal(expected, typeName.ToString());
            typeName.Clear();
            csharp.AppendAliasNameTo(type, typeName);
            Assert.Equal(expected, typeName.ToString());
        }