示例#1
0
        private void GenericTypeTest(TypeName root, bool hasAssembly)
        {
            var rootType = GenericType;

            InstanceTest(rootType, root, hasAssembly);
            Assert.AreEqual(Type.GetType(root.DeclareName), typeof(Dictionary <,>));
            Assert.Null(root.GenericParent);

            var arg0 = root.GetGenericArgument(0);

            InstanceTest <string>(arg0, hasAssembly);
            Assert.AreEqual(Type.GetType(arg0.DeclareName), typeof(string));
            Assert.AreEqual(arg0.GenericParent, root);

            var arg1 = root.GetGenericArgument(1);

            InstanceTest <KeyValuePair <TypeCache, Type> >(arg1, hasAssembly);
            Assert.AreEqual(Type.GetType(arg1.DeclareName), typeof(KeyValuePair <,>));
            Assert.AreEqual(arg1.GenericParent, root);

//            var arg10 = arg1.GetGenericArgument(0);
//            TestInstance<TypeCache>(arg10, hasAssembly);
//            Assert.AreEqual(Assemblies.UserRuntime.GetType(arg10.DeclareName), typeof(TypeCache));
//            Assert.AreEqual(arg10.GenericParent, arg1);
//
//            var arg11 = arg1.GetGenericArgument(1);
//            TestInstance<EditorSceneManager>(arg11, hasAssembly);
//            Assert.AreEqual(Assemblies.UnityEditor.GetType(arg11.DeclareName), typeof(EditorSceneManager));
//            Assert.AreEqual(arg11.GenericParent, arg1);
        }
示例#2
0
        private void NestedGenericArrayTypeTest(TypeName root, bool hasAssembly)
        {
            var rootType = NestedGenericArrayType;

            InstanceTest(rootType, root, hasAssembly);
            Assert.Null(root.GenericParent);

            var arg0 = root.GetGenericArgument(0);

            InstanceTest <string>(arg0, hasAssembly);
            Assert.AreEqual(root, arg0.GenericParent);

            var arg1 = root.GetGenericArgument(1);

            InstanceTest <KeyValuePair <TypeCache, Type[, ]> >(arg1, hasAssembly);
            Assert.AreEqual(root, arg1.GenericParent);

            var arg10 = arg1.GetGenericArgument(0);

            InstanceTest <TypeCache>(arg10, hasAssembly);
            Assert.AreEqual(arg1, arg10.GenericParent);

            var arg11 = arg1.GetGenericArgument(1);

            InstanceTest <Type[, ]>(arg11, hasAssembly);
            Assert.AreEqual(arg1, arg11.GenericParent);
        }