示例#1
0
        public void ImportInNestedNamespace(string atGlobal, string inNamespace, string inNestedNamespace, Type type)
        {
            var csharp = new CSharpHelper();

            Assert.Equal(atGlobal, csharp.NameOf(type));
            using (csharp.BeginNamespaceDeclaration("Fsi"))
            {
                csharp.Import("System");
                Assert.Equal(inNamespace, csharp.NameOf(type));
                using (csharp.BeginNamespaceDeclaration("TextTemplating"))
                {
                    csharp.Import("System.Threading");
                    Assert.Equal(inNestedNamespace, csharp.NameOf(type));
                }
            }
            Assert.Equal(atGlobal, csharp.NameOf(type));
            using (csharp.BeginNamespaceDeclaration("Fsi"))
            {
                csharp.Import("System");
                Assert.Equal(inNamespace, csharp.NameOf(type));
                using (csharp.BeginNamespaceDeclaration("TextTemplating"))
                {
                    csharp.Import("System.Threading");
                    Assert.Equal(inNestedNamespace, csharp.NameOf(type));
                }
            }
        }
示例#2
0
        public void ImportAtGlobal(string expected, Type type)
        {
            var csharp = new CSharpHelper();

            csharp.Import("System");
            csharp.Import("System.Threading");
            Assert.Equal(expected, csharp.NameOf(type));
        }
示例#3
0
        protected void TypeOfNameOf(string expected, Type type)
        {
            var csharp = new CSharpHelper();

            csharp.Import("System");
            csharp.Import("System.Threading");
            Assert.Equal(expected, csharp.TypeOfNameOf(type));
            Assert.Equal(expected, csharp.TypeOfNameOf(type));
        }
示例#4
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());
        }
示例#5
0
        public void CRefNameOfWithoutSystemNamespace(string expected, Type type)
        {
            var csharp = new CSharpHelper();

            csharp.Import("System.Threading");
            Assert.Equal(expected, csharp.CRefNameOf(type));
            Assert.Equal(expected, csharp.CRefNameOf(type));
        }