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

C# IPatternScope类代码示例

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

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



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

示例1: DecorateAssemblyTest

 /// <inheritdoc />
 protected override void DecorateAssemblyTest(IPatternScope assemblyScope, IAssemblyInfo assembly)
 {
     assemblyScope.TestBuilder.TestActions.InitializeTestChain.After(state =>
     {
         TestAssemblyExecutionParameters.DefaultTestCaseTimeout = Timeout;
     });
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:8,代码来源:DefaultTestCaseTimeoutAttribute.cs


示例2: DecorateAssemblyTest

 /// <inheritdoc />
 protected override void DecorateAssemblyTest(IPatternScope assemblyScope, IAssemblyInfo assembly)
 {
     assemblyScope.TestBuilder.TestActions.InitializeTestChain.After(state =>
     {
         TestAssemblyExecutionParameters.DegreeOfParallelism = degreeOfParallelism;
     });
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:8,代码来源:DegreeOfParallelismAttribute.cs


示例3: DecorateContainingScope

 /// <inheritdoc />
 protected override void DecorateContainingScope(IPatternScope containingScope, IMethodInfo methodInfo)
 {
     Type formattableType = methodInfo.Parameters[0].Resolve(true).ParameterType;
     var extensionPoints = (IExtensionPoints)RuntimeAccessor.ServiceLocator.ResolveByComponentId("Gallio.ExtensionPoints");
     CustomTestEnvironment.SetUpThreadChain.Before(() => extensionPoints.CustomFormatters.Register(formattableType, x => (string)methodInfo.Resolve(true).Invoke(this, new[] { x })));
     CustomTestEnvironment.TeardownThreadChain.After(() => extensionPoints.CustomFormatters.Unregister(formattableType));
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:8,代码来源:FormatterAttribute.cs


示例4: 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


示例5: Validate

        /// <inheritdoc />
        protected override void Validate(IPatternScope containingScope, IMethodInfo method)
        {
            base.Validate(containingScope, method);

            if (method.Parameters.Count != 0)
                ThrowUsageErrorException("A fixture set-up method must not have any parameters.");
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:8,代码来源:FixtureSetUpAttribute.cs


示例6: Validate

        /// <inheritdoc />
        protected override void Validate(IPatternScope containingScope, ITypeInfo type)
        {
            base.Validate(containingScope, type);

            if (type.IsAbstract && type.IsSealed)
                ThrowUsageErrorException("This attribute cannot be used on a static class.");
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:8,代码来源:TestFixtureAttribute.cs


示例7: 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


示例8: DecorateContainingScope

 /// <inheritdoc />
 protected override void DecorateContainingScope(IPatternScope containingScope, IMethodInfo method)
 {
     containingScope.TestBuilder.TestInstanceActions.InitializeTestInstanceChain.After(
         delegate(PatternTestInstanceState testInstanceState)
         {
             testInstanceState.InvokeFixtureMethod(method, EmptyArray<KeyValuePair<ISlotInfo, object>>.Instance);
         });
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:9,代码来源:FixtureInitializerAttribute.cs


示例9: 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


示例10: 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


示例11: 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


示例12: 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


示例13: 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


示例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: 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


示例16: Validate

        /// <inheritdoc />
        protected override void Validate(IPatternScope containingScope, IMethodInfo method)
        {
            base.Validate(containingScope, method);

            if (method.ReturnType.Resolve(true) == typeof(void))
                ThrowUsageErrorException(String.Format("Expected the custom conversion method '{0}' to not return void.", method.Name));

            if (method.Parameters.Count != 1)
                ThrowUsageErrorException(String.Format("Expected the custom conversion method '{0}' to take only one parameter, but found {1}.", method.Name, method.Parameters.Count));
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:11,代码来源:ConverterAttribute.cs


示例17: Validate

        /// <inheritdoc />
        protected override void Validate(IPatternScope containingScope, IMethodInfo method)
        {
            base.Validate(containingScope, method);

            if (method.ReturnType.Resolve(true) != typeof(string))
                ThrowUsageErrorException(String.Format("Expected the custom formatting method '{0}' to return a value of type '{1}', but found '{2}'.", method.Name, typeof(string), method.ReturnType));

            if (method.Parameters.Count != 1)
                ThrowUsageErrorException(String.Format("Expected the custom formatting method '{0}' to take only one parameter, but found {1}.", method.Name, method.Parameters.Count));
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:11,代码来源:FormatterAttribute.cs


示例18: 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 type = codeElement as ITypeInfo;
            Validate(containingScope, type);

            ITestBuilder assemblyTest = containingScope.TestBuilder;
            InitializeTest(containingScope, type);
            SetTestSemantics(assemblyTest, type);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:12,代码来源:AssemblyFixtureAttribute.cs


示例19: 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.TestBuilder.AddDeferredAction(codeElement, Order, delegate
            {
                DecorateTest(scope, codeElement);
            });
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:12,代码来源:TestDecoratorPatternAttribute.cs


示例20: 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);
            IConstructorInfo constructor = codeElement as IConstructorInfo;
            Validate(containingScope, constructor);

            IPatternScope dataContextScope = containingScope.CreateChildTestDataContextScope(codeElement);

            InitializeDataContext(dataContextScope, constructor);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:12,代码来源:TestConstructorPatternAttribute.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IPayment类代码示例发布时间:2022-05-24
下一篇:
C# IPath类代码示例发布时间: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