Consumes a code element and applies its contributions to the scope provided by a containing pattern.

Namespace:  MbUnit.Framework
Assembly:  Gallio (in Gallio.dll) Version: 3.3.0.0 (3.3.610.0)

Syntax

C#
public override void Consume(
	IPatternScope containingScope,
	ICodeElementInfo codeElement,
	bool skipChildren
)
Visual Basic (Declaration)
Public Overrides Sub Consume ( _
	containingScope As IPatternScope, _
	codeElement As ICodeElementInfo, _
	skipChildren As Boolean _
)

Parameters

containingScope
Type: Gallio.Framework.Pattern..::.IPatternScope
The containing scope.
codeElement
Type: Gallio.Common.Reflection..::.ICodeElementInfo
The code element to process.
skipChildren
Type: System..::.Boolean
If true, skips generating child test components. Instead the children may be populated on demand using AddDeferredComponentPopulator(DeferredComponentPopulator). The implementation may safely ignore the value of this flag so long as subsequent attempts to populate children on demand are idempotent (do nothing or have no adverse side-effects).

Implements

IPattern..::.Consume(IPatternScope, ICodeElementInfo, Boolean)

Remarks

This method is used to declare new tests, test parameters and other components and add them to a containing test that was defined in some other scope.

For example, when enumerating test fixtures, the assembly-level pattern will call the Consume(IPatternScope, ICodeElementInfo, Boolean) method of the primary patterns associated with each type in an assembly. Some of these patterns will create new test fixture objects and add them as children of the containing assembly-level test. They will then call the Process(IPatternScope, ICodeElementInfo) method of each non-primary pattern associated with the type within the scope of the test fixture. Then they will typically recurse into the fixture to apply contributions defined by patterns associated with methods, fields, properties, events, constructors and generic type parameters.

This method is only called for primary patterns.

Exceptions

ExceptionCondition
Gallio.Framework.Pattern..::.PatternUsageErrorExceptionMay be thrown to halt processing of the pattern and report an error message to the user as an annotation that describes how the pattern was misapplied.

See Also