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


C# IPatternScope类代码示例

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


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


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