コード例 #1
0
        public void TypeOfNameArgNull()
        {
            var csharp = new CSharpHelper();

            Assert.Throws <ArgumentNullException>("type",
                                                  () => { csharp.AppendTypeOfNameTo(default(Type), new StringBuilder()); });
            Assert.Throws <ArgumentNullException>("typeName",
                                                  () => { csharp.AppendTypeOfNameTo(typeof(int), default(StringBuilder)); });
            Assert.Throws <ArgumentNullException>("type",
                                                  () => { csharp.TypeOfNameOf(default(Type)); });
        }
コード例 #2
0
        protected void AppendTypeOfNameTo(string expected, Type type)
        {
            var csharp = new CSharpHelper();

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

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