• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ICodeElementInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ICodeElementInfo的典型用法代码示例。如果您正苦于以下问题:C# ICodeElementInfo类的具体用法?C# ICodeElementInfo怎么用?C# ICodeElementInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ICodeElementInfo类属于命名空间,在下文中一共展示了ICodeElementInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ExploreImpl

        protected override void ExploreImpl(IReflectionPolicy reflectionPolicy, ICodeElementInfo codeElement)
        {
            InitializeExplorerIfNeeded(reflectionPolicy);

            IAssemblyInfo assembly = ReflectionUtils.GetAssembly(codeElement);
            if (assembly != null)
            {
                bool skipChildren = ! (codeElement is IAssemblyInfo);
                if (BuildAssemblyTest(assembly, skipChildren))
                {
                    foreach (IPatternScope scope in evaluator.GetScopes(assembly))
                        scope.PopulateDeferredComponents(null);

                    assemblies[assembly] = true;
                }
                else
                {
                    ITypeInfo type = ReflectionUtils.GetType(codeElement);
                    if (type != null)
                    {
                        foreach (IPatternScope scope in evaluator.GetScopes(assembly))
                            scope.PopulateDeferredComponents(type);
                    }
                }
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:26,代码来源:PatternTestExplorer.cs


示例2: ContractVerificationContext

        /// <summary>
        /// Constructs an execution context for the verification tests of a contract verifier.
        /// </summary>
        /// <param name="codeElement">The code element for the contract read-only field.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="codeElement"/> is null.</exception>
        public ContractVerificationContext(ICodeElementInfo codeElement)
        {
            if (codeElement == null)
                throw new ArgumentNullException("codeElement");

            this.codeElement = codeElement;
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:12,代码来源:ContractVerificationContext.cs


示例3: Annotation

 /// <summary>
 /// Creates an annotation with a detail message string.
 /// </summary>
 /// <param name="type">The annotation type.</param>
 /// <param name="codeElement">The associated code element, or null if none.</param>
 /// <param name="message">The annotation message.</param>
 /// <param name="details">Additional details such as exception text or null if none.</param>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="message"/> is null.</exception>
 public Annotation(AnnotationType type, ICodeElementInfo codeElement, string message, string details)
 {
     this.type = type;
     this.codeElement = codeElement;
     this.message = message;
     this.details = details;
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:15,代码来源:Annotation.cs


示例4: CreateFromTest

        public static GallioTestElement CreateFromTest(TestData test, ICodeElementInfo codeElement, IUnitTestProvider provider, 
			GallioTestElement parent)
        {
            if (test == null)
                throw new ArgumentNullException("test");

            // The idea here is to generate a test element object that does not retain any direct
            // references to the code element info and other heavyweight objects.  A test element may
            // survive in memory for quite a long time so we don't want it holding on to all sorts of
            // irrelevant stuff.  Basically we flatten out the test to just those properties that we
            // need to keep.
            var element = new GallioTestElement(provider, parent,
                test.Id,
                test.Name,
                test.Metadata.GetValue(MetadataKeys.TestKind) ?? "Unknown",
                test.IsTestCase,
                ReSharperReflectionPolicy.GetProject(codeElement),
                ReSharperReflectionPolicy.GetDeclaredElementResolver(codeElement),
                GetAssemblyPath(codeElement),
                GetTypeName(codeElement),
                GetNamespaceName(codeElement));

            var categories = test.Metadata[MetadataKeys.Category];
            if (categories.Count != 0)
                element.Categories = UnitTestElementCategory.Create(categories);

            var reason = test.Metadata.GetValue(MetadataKeys.IgnoreReason);
            if (reason != null)
                element.ExplicitReason = reason;

            return element;
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:32,代码来源:GallioTestElement6.cs


示例5: DecorateTest

        /// <inheritdoc />
        protected override void DecorateTest(IPatternScope scope, ICodeElementInfo codeElement)
        {
            scope.TestBuilder.TestInstanceActions.RunTestInstanceBodyChain.Around(delegate(PatternTestInstanceState state, Func<PatternTestInstanceState, TestOutcome> inner)
            {
                TestOutcome outcome = TestOutcome.Passed;
                int passedCount = 0;

                for (int i = 0; i < numRepetitions; i++)
                {
                    string name = String.Format("Repetition #{0}", i + 1);
                    TestContext context = TestStep.RunStep(name, delegate
                    {
                        TestOutcome innerOutcome = inner(state);
                        if (innerOutcome.Status != TestStatus.Passed)
                            throw new SilentTestException(innerOutcome);
                    }, null, false, codeElement);

                    outcome = outcome.CombineWith(context.Outcome);
                    if (context.Outcome.Status == TestStatus.Passed)
                        passedCount += 1;
                }

                TestLog.WriteLine(String.Format("{0} of {1} repetitions passed.",
                    passedCount, numRepetitions));

                return outcome;
            });
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:29,代码来源:RepeatAttribute.cs


示例6: OpenXDocument

 /// <summary>
 /// Uses the existing Gallio plumbing to locate files
 /// </summary>
 protected XDocument OpenXDocument(ICodeElementInfo codeElement)
 {
     using (TextReader reader = OpenTextReader(codeElement))
     {
         return XDocument.Load(reader);
     }
 }
开发者ID:rprouse,项目名称:mbunit-v3,代码行数:10,代码来源:XmlDataObjectAttribute.cs


示例7: PopulateDataSource

 /// <inheritdoc />
 protected override void PopulateDataSource(IPatternScope scope, DataSource dataSource, ICodeElementInfo codeElement)
 {
     var invoker = new FixtureMemberInvoker<IEnumerable>(factoryType, scope, factoryMethodName);
     XDocument xdocument = OpenXDocument(codeElement);
     var parameters = new object[] { GetElementList(xdocument, xPath) };
     var dataSet = new FactoryDataSet(() => invoker.Invoke(parameters), kind, columnCount);
     dataSource.AddDataSet(dataSet);
 }
开发者ID:rprouse,项目名称:mbunit-v3,代码行数:9,代码来源:XmlDataObjectAttribute.cs


示例8: Process

        /// <inheritdoc />
        public override void Process(IPatternScope scope, ICodeElementInfo codeElement)
        {
            //TODO: Review: Issue 762: Shouldn't the base method be invoked here?
            //base.Process(scope, codeElement);
            Validate(scope, codeElement);

            scope.TestComponentBuilder.Name = name;
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:9,代码来源:NameAttribute.cs


示例9: Consume

 /// <inheritdoc />
 public override void Consume(IPatternScope containingScope, ICodeElementInfo codeElement, bool skipChildren)
 {
     //TODO: Review: Issue 762: Shouldn't the base method be invoked here?
     //base.Consume(containingScope, codeElement, skipChildren);
     var method = codeElement as IMethodInfo;
     Validate(containingScope, method);
     containingScope.TestComponentBuilder.AddDeferredAction(codeElement, Order, () => DecorateContainingScope(containingScope, method));
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:9,代码来源:ExtensionPointPatternAttribute.cs


示例10: DecorateTest

 protected override void DecorateTest(IPatternScope scope, ICodeElementInfo codeElement)
 {
     scope.TestBuilder.TestInstanceActions.DecorateChildTestChain.After(
         delegate(PatternTestInstanceState state, PatternTestActions actions)
         {
             AddDecorator(actions.TestInstanceActions.ExecuteTestInstanceChain);
         });
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:8,代码来源:RunWithGuardedReadLockAttribute.cs


示例11: PopulateDataSource

 protected override void PopulateDataSource(IPatternScope scope, DataSource dataSource, ICodeElementInfo codeElement)
 {
     for (int i = 1; i <= count; i++)
     {
         var row = new object[] { i, "Hello from #" + i };
         dataSource.AddDataSet(new ItemSequenceDataSet(new IDataItem[] { new ListDataItem<object>(row, GetMetadata(), false) }, row.Length));
     }
 }
开发者ID:KidFashion,项目名称:UBL.net,代码行数:8,代码来源:Example.cs


示例12: GetPatterns

        /// <inheritdoc />
        public IEnumerable<IPattern> GetPatterns(ICodeElementInfo codeElement)
        {
            if (codeElement == null)
                throw new ArgumentNullException("codeElement");

            foreach (PatternAttribute attribute in AttributeUtils.GetAttributes<PatternAttribute>(codeElement, true))
                yield return attribute;
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:9,代码来源:DeclarativePatternResolver.cs


示例13: XunitTest

        /// <summary>
        /// Initializes a test initially without a parent.
        /// </summary>
        /// <param name="name">The name of the component.</param>
        /// <param name="codeElement">The point of definition, or null if none.</param>
        /// <param name="typeInfo">The Xunit test type information.</param>
        /// <param name="methodInfo">The Xunit test method information, or null if none.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="name"/> or <paramref name="typeInfo"/> is null.</exception>
        public XunitTest(string name, ICodeElementInfo codeElement, XunitTypeInfoAdapter typeInfo, XunitMethodInfoAdapter methodInfo)
            : base(name, codeElement)
        {
            if (typeInfo == null)
                throw new ArgumentNullException(@"typeInfo");

            this.typeInfo = typeInfo;
            this.methodInfo = methodInfo;
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:17,代码来源:XunitTest.cs


示例14: PopulateDataSource

 /// <inheritdoc />
 protected override void PopulateDataSource(IPatternScope scope, DataSource dataSource, ICodeElementInfo codeElement)
 {
     using (var textReader = OpenTextReader(codeElement))
     {
         var text = textReader.ReadToEnd();
         var dataSet = new ValueSequenceDataSet(new[] { text }, null, false);
         dataSource.AddDataSet(dataSet);
     }
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:10,代码来源:TextDataAttribute.cs


示例15: GetTestParts

        /// <inheritdoc />
        public IList<TestPart> GetTestParts(IReflectionPolicy reflectionPolicy, ICodeElementInfo codeElement)
        {
            if (reflectionPolicy == null)
                throw new ArgumentNullException("reflectionPolicy");
            if (codeElement == null)
                throw new ArgumentNullException("codeElement");

            return GetTestPartsImpl(reflectionPolicy, codeElement);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:10,代码来源:BaseTestDriver.cs


示例16: Explore

        /// <summary>
        /// Explores tests defined by the specified code element and populates the explorer's test model.
        /// </summary>
        /// <param name="reflectionPolicy">The reflection policy.</param>
        /// <param name="codeElement">The code element.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="reflectionPolicy"/>,
        /// <paramref name="codeElement"/> is null.</exception>
        public void Explore(IReflectionPolicy reflectionPolicy, ICodeElementInfo codeElement)
        {
            if (reflectionPolicy == null)
                throw new ArgumentNullException("reflectionPolicy");
            if (codeElement == null)
                throw new ArgumentNullException("codeElement");

            ExploreImpl(reflectionPolicy, codeElement);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:16,代码来源:TestExplorer.cs


示例17: Process

        /// <inheritdoc />
        public override void Process(IPatternScope scope, ICodeElementInfo codeElement)
        {
            //TODO: Review: Issue 762: Shouldn't the base method be invoked here?
            //base.Process(scope, codeElement);
            Validate(scope, codeElement);

            foreach (KeyValuePair<string, string> pair in GetMetadata())
                scope.TestComponentBuilder.AddMetadata(pair.Key, pair.Value);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:10,代码来源:MetadataPatternAttribute.cs


示例18: PatternTest

        /// <summary>
        /// Initializes a test initially without a parent.
        /// </summary>
        /// <param name="name">The name of the test.</param>
        /// <param name="codeElement">The point of definition of the test, or null if unknown.</param>
        /// <param name="dataContext">The data context.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="name"/> or <paramref name="dataContext"/> is null.</exception>
        public PatternTest(string name, ICodeElementInfo codeElement, PatternTestDataContext dataContext)
            : base(name, codeElement)
        {
            if (dataContext == null)
                throw new ArgumentNullException("dataContext");

            this.dataContext = dataContext;
            testActions = new PatternTestActions();
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:16,代码来源:PatternTest.cs


示例19: ConcordionTest

        /// <summary>
        /// Initializes a new instance of the <see cref="ConcordionTest"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="codeElement">The code element.</param>
        /// <param name="typeInfo">The type info.</param>
        /// <param name="resource">The resource.</param>
        /// <param name="fixtureType">The fixture type.</param>
        public ConcordionTest(string name, ICodeElementInfo codeElement, ConcordionTypeInfoAdapter typeInfo, Resource resource, Type fixtureType)
            : base(name, codeElement)
        {
            if (typeInfo == null)
                throw new ArgumentNullException(@"typeInfo");

            this.TypeInfo = typeInfo;
            this.Resource = resource;
            this.FixtureType = fixtureType;
        }
开发者ID:Erls-Corporation,项目名称:concordion-net,代码行数:18,代码来源:ConcordionTest.cs


示例20: PopulateDataSource

 /// <inheritdoc />
 protected override void PopulateDataSource(IPatternScope scope, DataSource dataSource, ICodeElementInfo codeElement)
 {
     using (var stream = OpenStream(codeElement))
     {
         var bytes = new byte[stream.Length];
         stream.Read(bytes, 0, bytes.Length);
         var dataSet = new ValueSequenceDataSet(new[] { bytes }, null, false);
         dataSource.AddDataSet(dataSet);
     }
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:11,代码来源:BinaryDataAttribute.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ICodeGenerator类代码示例发布时间:2022-05-24
下一篇:
C# ICodeElement类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap