本文整理汇总了C#中IPatternScope.CreateChildTestScope方法的典型用法代码示例。如果您正苦于以下问题:C# IPatternScope.CreateChildTestScope方法的具体用法?C# IPatternScope.CreateChildTestScope怎么用?C# IPatternScope.CreateChildTestScope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPatternScope
的用法示例。
在下文中一共展示了IPatternScope.CreateChildTestScope方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
IMethodInfo method = codeElement as IMethodInfo;
Validate(containingScope, method);
IPatternScope methodScope = containingScope.CreateChildTestScope(method.Name, method);
methodScope.TestBuilder.Kind = TestKinds.Test;
methodScope.TestBuilder.IsTestCase = true;
methodScope.TestBuilder.Order = Order;
methodScope.TestBuilder.TimeoutFunc = () => TestAssemblyExecutionParameters.DefaultTestCaseTimeout;
InitializeTest(methodScope, method);
SetTestSemantics(methodScope.TestBuilder, method);
methodScope.TestBuilder.ApplyDeferredActions();
}
示例2: 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);
IFieldInfo field = codeElement as IFieldInfo;
Validate(containingScope, field);
IPatternScope fieldScope = containingScope.CreateChildTestScope(field.Name, field);
fieldScope.TestBuilder.Kind = TestKinds.Suite;
fieldScope.TestBuilder.IsTestCase = false;
InitializeTest(fieldScope, field);
GenerateTestsFromContract(fieldScope, field, containingScope);
fieldScope.TestBuilder.ApplyDeferredActions();
}
示例3: BuildStaticTest
/// <inheritdoc />
protected override void BuildStaticTest(IPatternScope containingScope, ICodeElementInfo declaringCodeElement)
{
IPatternScope childTestScope = containingScope.CreateChildTestScope(Name, CodeElement ?? declaringCodeElement);
childTestScope.TestBuilder.Kind = Kind;
childTestScope.TestBuilder.TimeoutFunc = () => Timeout;
childTestScope.TestBuilder.IsTestCase = IsTestCase;
foreach (var pair in Metadata.Pairs)
childTestScope.TestBuilder.AddMetadata(pair.Key, pair.Value);
childTestScope.TestBuilder.TestInstanceActions.SetUpTestInstanceChain.Before(state => OnSetupSelf());
childTestScope.TestBuilder.TestInstanceActions.ExecuteTestInstanceChain.After(state => OnExecuteSelf());
childTestScope.TestBuilder.TestInstanceActions.TearDownTestInstanceChain.After(state => OnTearDownSelf());
childTestScope.TestBuilder.TestInstanceActions.DecorateChildTestChain.After((outerState, decoratedChildActions) =>
decoratedChildActions.TestInstanceActions.SetUpTestInstanceChain.Before(innerState => OnSetupChild()));
childTestScope.TestBuilder.TestInstanceActions.DecorateChildTestChain.After((outerState, decoratedChildActions) =>
decoratedChildActions.TestInstanceActions.TearDownTestInstanceChain.After(innerState => OnTearDownChild()));
BuildStaticTests(GetChildren(), childTestScope, declaringCodeElement);
}
示例4: 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 assembly = codeElement as IAssemblyInfo;
Validate(containingScope, assembly);
IPatternScope assemblyScope = containingScope.CreateChildTestScope(assembly.Name, assembly);
assemblyScope.TestBuilder.Kind = TestKinds.Assembly;
assemblyScope.TestBuilder.AddMetadata(MetadataKeys.File, assembly.Path);
InitializeAssemblyTest(assemblyScope, assembly);
SetTestSemantics(assemblyScope.TestBuilder, assembly);
if (skipChildren)
PrepareToPopulateChildrenOnDemand(assemblyScope, assembly);
else
PopulateChildrenImmediately(assemblyScope, assembly);
assemblyScope.TestBuilder.ApplyDeferredActions();
}