当前位置: 首页>>代码示例>>C#>>正文


C# ElementResolver.LookupAssemblyName方法代码示例

本文整理汇总了C#中ProtoCore.Namespace.ElementResolver.LookupAssemblyName方法的典型用法代码示例。如果您正苦于以下问题:C# ElementResolver.LookupAssemblyName方法的具体用法?C# ElementResolver.LookupAssemblyName怎么用?C# ElementResolver.LookupAssemblyName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProtoCore.Namespace.ElementResolver的用法示例。


在下文中一共展示了ElementResolver.LookupAssemblyName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VerifyResult

        private void VerifyResult(string fullName, string partialName, string functionOrProperty, bool isProperty = false)
        {
            var testCore = thisTest.GetTestCore();

            var astNodes = CoreUtils.BuildASTList(testCore, string.Format("d = {0}.{1};", partialName, functionOrProperty));

            var elementResolver = new ElementResolver();

            var newNodes = ElementRewriter.RewriteElementNames(testCore.ClassTable, elementResolver, astNodes);

            Assert.AreEqual(string.Format("d = {0}.{1};\n", fullName, functionOrProperty), newNodes.ElementAt(0).ToString());

            if (!isProperty)
            {
                // Add verification for contents of element resolver resolution map
                var assembly = elementResolver.LookupAssemblyName(partialName);
                var resolvedName = elementResolver.LookupResolvedName(partialName);

                Assert.AreEqual("FFITarget.dll", assembly);
                Assert.AreEqual(fullName, resolvedName);
            }
        }
开发者ID:rafatahmed,项目名称:Dynamo,代码行数:22,代码来源:ElementRewriterTests.cs

示例2: LookupResolvedName_FromCompiler_RewriteAst

        public void LookupResolvedName_FromCompiler_RewriteAst()
        {

            const string code = @"import (""FFITarget.dll"");";
            var mirror = thisTest.RunScriptSource(code);

            var testCore = thisTest.GetTestCore();
            var astNodes = CoreUtils.BuildASTList(testCore, "d = ElementResolverTarget.ElementResolverTarget();");

            var elementResolver = new ElementResolver();

            var newNodes = ElementRewriter.RewriteElementNames(testCore.ClassTable, elementResolver, astNodes);

            Assert.AreEqual("d = FFITarget.ElementResolverTarget.ElementResolverTarget();\n", newNodes.ElementAt(0).ToString());

            // Add verification for contents of element resolver resolution map
            Assert.AreEqual(1, elementResolver.ResolutionMap.Count);

            var assembly = elementResolver.LookupAssemblyName("ElementResolverTarget");
            var resolvedName = elementResolver.LookupResolvedName("ElementResolverTarget");

            Assert.AreEqual("FFITarget.dll", assembly);
            Assert.AreEqual("FFITarget.ElementResolverTarget", resolvedName);
        }
开发者ID:rafatahmed,项目名称:Dynamo,代码行数:24,代码来源:ElementRewriterTests.cs

示例3: LookupResolvedName_ForNestedNamespacesExpressionFromCompiler_RewriteAst

        public void LookupResolvedName_ForNestedNamespacesExpressionFromCompiler_RewriteAst()
        {
            const string code = @"import (""FFITarget.dll"");";
            var mirror = thisTest.RunScriptSource(code);

            var testCore = thisTest.GetTestCore();
            string class1 = "NestedResolverTarget";
            string class2 = "ElementResolverTarget";
            string fullName1 = "FFITarget.NameSpaceA.NameSpaceB.NameSpaceC.NestedResolverTarget";
            string fullName2 = "FFITarget.ElementResolverTarget";
            var astNodes = CoreUtils.BuildASTList(testCore, string.Format("d = {0}.Property.Method({1}.Create().Property.Method({0}.Property.Property));", class1, class2));

            var elementResolver = new ElementResolver();

            var newNodes = ElementRewriter.RewriteElementNames(testCore.ClassTable, elementResolver, astNodes);

            Assert.AreEqual(
                string.Format("d = {0}.Property.Method({1}.Create().Property.Method({0}.Property.Property));\n", fullName1, fullName2), 
                newNodes.ElementAt(0).ToString());

            // Add verification for contents of element resolver resolution map
            var assembly = elementResolver.LookupAssemblyName(class2);
            var resolvedName = elementResolver.LookupResolvedName(class2);

            Assert.AreEqual("FFITarget.dll", assembly);
            Assert.AreEqual(fullName2, resolvedName);

            ///////////////////////////////////////////////
            astNodes = CoreUtils.BuildASTList(testCore, string.Format("d = {0}.Property.Method({1}.Create().Property.Method({0}.Property.Property));", fullName1, fullName2));

            elementResolver = new ElementResolver();

            newNodes = ElementRewriter.RewriteElementNames(testCore.ClassTable, elementResolver, astNodes);

            Assert.AreEqual(
                string.Format("d = {0}.Property.Method({1}.Create().Property.Method({0}.Property.Property));\n", fullName1, fullName2),
                newNodes.ElementAt(0).ToString());

            // Add verification for contents of element resolver resolution map
            assembly = elementResolver.LookupAssemblyName(fullName2);
            resolvedName = elementResolver.LookupResolvedName(fullName2);

            Assert.AreEqual("FFITarget.dll", assembly);
            Assert.AreEqual(fullName2, resolvedName);
        }
开发者ID:rafatahmed,项目名称:Dynamo,代码行数:45,代码来源:ElementRewriterTests.cs


注:本文中的ProtoCore.Namespace.ElementResolver.LookupAssemblyName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。