BizUnit BREExecuteStep
The BREExecuteStep can be used to unit test business rules submitting content to the Microsoft Business Rules Engine (BRE) and optionally validate the output for expected results.
Configuration Table
| Property Name | Description | Required |
| SourceDocument | The path for the source document to be submitted to the Business Rule Engine. This property is optional if a source document is being provided by a context loader. | No |
| DocumentType | The Business Rule Source Document Type. In a BizTalk project, this property should be set with the source document schema type name. This property is only required when SourceDocument is supplied. | No |
| FactsContextKey | Optional property to be filled if additional facts other than the source document need to be submitted to the Business Rule Engine. If this property is supplied the BizUnit Step will try to load facts from the BizUnit Context using the key name provided and forward them to the BRE. | No |
| PolicyName | The policy name to be executed by the unit test step. | Yes |
| PolicyVersionMajorRevision | The major revision of the policy version. As an example, if the policy version to be executed is 1.0, this field should be set to 1. If this property is not supplied the unit test step will execute the latest version deployed in the Business Rule Engine repository. | No |
| PolicyVersionMinorRevision | The minor revision of the policy version. As an example, if the policy version to be executed is 1.0, this field should be set to 0. This property is only required when PolicyVersionMajorRevision is supplied. | No |
| ContextLoaderSteps | Allows additional information to be pre-loaded into the BizUnit context. As an example of utilization, ESBToolkitResolutionContextLoader could be used to load additional facts to be sent to the BRE as part of the unit test. See FactsContextKey property to get more details on how ContextLoaderSteps and ValidationSteps can be used as a complement of this unit test step. | No |
| ValidationSteps | Allows the inclusion of validation points against the results of the pre-configured business rule execution. | No |
Configuration Examples
With Validation Step
<TestStep assemblyPath="WhiteboardWorks.BizUnitSteps.dll" typeName="WhiteboardWorks.BizUnitSteps.BREExecuteStep">
<SourceDocument>mySourceDocument.xml</SourceDocument>
<DocumentType>MyDocumentType</DocumentType>
<PolicyName>ResolveEndpoint_XYZ</PolicyName>
<PolicyVersionMajorRevision>1</PolicyVersionMajorRevision>
<PolicyVersionMinorRevision>0</PolicyVersionMinorRevision>
<ValidationStep assemblyPath="" typeName="BizUnit.XmlValidationStepEx">
<XmlSchemaPath>MySchema.xsd</XmlSchemaPath>
<XmlSchemaNameSpace>http://foo/xyz</XmlSchemaNameSpace>
</ValidationStep>
</TestStep>
With Context Loader and Validation Step
<TestStep assemblyPath="WhiteboardWorks.BizUnitSteps.dll" typeName=" WhiteboardWorks.BizUnitSteps.BREExecuteStep">
<FactsContextKey>Facts</FactsContextKey>
<PolicyName>ResolveEndpoint_XYZ</PolicyName>
<PolicyVersionMajorRevision>1</PolicyVersionMajorRevision>
<PolicyVersionMinorRevision>0</PolicyVersionMinorRevision>
<ContextLoaderStep assemblyPath="WhiteboardWorks.BizUnitSteps.dll" typeName="WhiteboardWorks.BizUnitSteps.ESBToolkitResolutionContextLoader">
<FactsContextKey>Facts</FactsContextKey>
<DocumentType>Microsoft.Practices.ESB.ResolveProviderMessage</DocumentType>
<SourceDocument>SourceDocument.xml</SourceDocument>
</ContextLoaderStep>
<ValidationStep assemblyPath="WhiteboardWorks.BizUnitSteps.dll" typeName="WhiteboardWorks.BizUnitSteps.ESBToolkitResolutionValidationStep">
<FactsContextKey>Facts</FactsContextKey>
<TransportType>WCF-SQL</TransportType>
<TransportLocation>http://databaseXYZ/ABC</TransportLocation>
<Action>SubmitMessage</Action>
<TargetNamespace>http://xyz/contoso</TargetNamespace>
</ValidationStep>
</TestStep>
BizUnit ESBToolkitResolutionContextLoader Step
The ESBToolkitResolutionContextLoader step loads an ESB Resolution object and optionally a source document into the BizUnit Context.
The ESB Resolution is a structure used by the ESB toolkit to apply endpoint and mapping dynamic resolution.
Configuration Table
| Property Name | Description | Required |
| SourceDocument | The path for the source document to be submitted to the Business Rule Engine. | No |
| DocumentType | The Business Rule Source Document Type. In a BizTalk project, this property should be set with the source document schema type name. This property is only required when SourceDocument is supplied. | No |
| FactsContextKey | This key name is used to load the configured facts into the BizUnit Context. This key can be used further to retrieve and process the facts accordingly. If other steps are using the context information loaded by this step, make sure that the 'FactsContextKey' property of each step match. | Yes |
| EndPointWCFAction | End Point WCF Action from ESB.EndPointInfo vocabulary. | No |
| ContextWCFAction | Context WCF Action from ESB.ContextInfo vocabulary | No |
| DocumentSpecName | Context Doc Spec Name from ESB.ContextInfo vocabulary. | No |
| DocumentSpecStrongName | Context Doc Spec Strong Name from ESB.ContextInfo vocabulary. | No |
| EndpointConfig | End Point Config from ESB.EndPointInfo vocabulary. | No |
| EpmRRCorrelationToken | Context EpmRRCorrelationToken from ESB.ContextInfo vocabulary. | No |
| FixJaxRpc | End Point Fix JAX RPC from ESB.EndPointInfo vocabulary. | No |
| InboundTransportLocation | Context Inbound Transport Location from ESB.ContextInfo vocabulary. | No |
| InboundTransportType | Context Inbound Transport Type from ESB.ContextInfo vocabulary. | No |
| InterchangeId | Context Interchange ID from ESB.ContextInfo vocabulary. | No |
| IsRequestResponse | Context Is Request Response from ESB.ContextInfo vocabulary. | No |
| MessageExchangePattern | End Point Message Exchange Pattern from ESB.EndPointInfo vocabulary. | No |
| MessageType | Context Message Type from ESB.ContextInfo vocabulary. | No |
| MethodName | Context SOAP Method from ESB.ContextInfo vocabulary. | No |
| ReceiveLocationName | Context Receive Location Name from ESB.ContextInfo vocabulary. | No |
| ReceivePortName | Context Receive Port Name from ESB.ContextInfo vocabulary. | No |
| TargetNamespace | End Point Target Namespace from ESB.EndPointInfo vocabulary. | No |
| TransformType | Transform Transform Type from ESB.TransformInfo vocabulary. | No |
| TransportLocation | End Point Outbound Transport Location from ESB.EndPointInfo vocabulary. | No |
| TransportNamespace | End Point Transport Namespace from ESB.EndPointInfo vocabulary. | No |
| TransportType | End Point Outbound Transport Type from ESB.EndPointInfo vocabulary. | No |
| WindowUser | Context Window User from ESB.ContextInfo vocabulary. | No |
Configuration Examples
<TestStep assemblyPath="WhiteboardWorks.BizUnitSteps.dll" typeName=" WhiteboardWorks.BizUnitSteps.BREExecuteStep">
<FactsContextKey>Facts</FactsContextKey>
<PolicyName>ResolveEndpoint_XYZ</PolicyName>
<PolicyVersionMajorRevision>1</PolicyVersionMajorRevision>
<PolicyVersionMinorRevision>0</PolicyVersionMinorRevision>
<ContextLoaderStep assemblyPath="WhiteboardWorks.BizUnitSteps.dll" typeName="WhiteboardWorks.BizUnitSteps.ESBToolkitResolutionContextLoader">
<FactsContextKey>Facts</FactsContextKey>
<DocumentType>Microsoft.Practices.ESB.ResolveProviderMessage</DocumentType>
<SourceDocument>SourceDocument.xml</SourceDocument>
</ContextLoaderStep>
<ValidationStep assemblyPath="WhiteboardWorks.BizUnitSteps.dll" typeName="WhiteboardWorks.BizUnitSteps.ESBToolkitResolutionValidationStep">
<FactsContextKey>Facts</FactsContextKey>
<TransportType>WCF-SQL</TransportType>
<TransportLocation>http://databaseXYZ/ABC</TransportLocation>
<Action>SubmitMessage</Action>
<TargetNamespace>http://xyz/contoso</TargetNamespace>
</ValidationStep>
</TestStep>
BizUnit ESBToolkitResolutionValidationStep Step
The ESBToolkitResolutionValidationStep step applies validation rules in a given ESB Resolution object retrieved from the BizUnit Context.
The ESB Resolution is a structure used by the ESB toolkit to apply endpoint and mapping dynamic resolution.
Configuration Table
| Property Name | Description | Required |
| FactsContextKey | This key name is used to load the configured facts into the BizUnit Context. This key can be used further to retrieve and process the facts accordingly. If other steps are using the context information loaded by this step, make sure that the 'FactsContextKey' property of each step match. | Yes |
| EndPointWCFAction | End Point WCF Action from ESB.EndPointInfo vocabulary. | No |
| ContextWCFAction | Context WCF Action from ESB.ContextInfo vocabulary | No |
| DocumentSpecName | Context Doc Spec Name from ESB.ContextInfo vocabulary. | No |
| DocumentSpecStrongName | Context Doc Spec Strong Name from ESB.ContextInfo vocabulary. | No |
| EndpointConfig | End Point Config from ESB.EndPointInfo vocabulary. | No |
| EpmRRCorrelationToken | Context EpmRRCorrelationToken from ESB.ContextInfo vocabulary. | No |
| FixJaxRpc | End Point Fix JAX RPC from ESB.EndPointInfo vocabulary. | No |
| InboundTransportLocation | Context Inbound Transport Location from ESB.ContextInfo vocabulary. | No |
| InboundTransportType | Context Inbound Transport Type from ESB.ContextInfo vocabulary. | No |
| InterchangeId | Context Interchange ID from ESB.ContextInfo vocabulary. | No |
| IsRequestResponse | Context Is Request Response from ESB.ContextInfo vocabulary. | No |
| MessageExchangePattern | End Point Message Exchange Pattern from ESB.EndPointInfo vocabulary. | No |
| MessageType | Context Message Type from ESB.ContextInfo vocabulary. | No |
| MethodName | Context SOAP Method from ESB.ContextInfo vocabulary. | No |
| ReceiveLocationName | Context Receive Location Name from ESB.ContextInfo vocabulary. | No |
| ReceivePortName | Context Receive Port Name from ESB.ContextInfo vocabulary. | No |
| TargetNamespace | End Point Target Namespace from ESB.EndPointInfo vocabulary. | No |
| TransformType | Transform Transform Type from ESB.TransformInfo vocabulary. | No |
| TransportLocation | End Point Outbound Transport Location from ESB.EndPointInfo vocabulary. | No |
| TransportNamespace | End Point Transport Namespace from ESB.EndPointInfo vocabulary. | No |
| TransportType | End Point Outbound Transport Type from ESB.EndPointInfo vocabulary. | No |
| WindowUser | Context Window User from ESB.ContextInfo vocabulary. | No |
Configuration Examples
<TestStep assemblyPath="WhiteboardWorks.BizUnitSteps.dll" typeName=" WhiteboardWorks.BizUnitSteps.BREExecuteStep">
<FactsContextKey>Facts</FactsContextKey>
<PolicyName>ResolveEndpoint_XYZ</PolicyName>
<PolicyVersionMajorRevision>1</PolicyVersionMajorRevision>
<PolicyVersionMinorRevision>0</PolicyVersionMinorRevision>
<ContextLoaderStep assemblyPath="WhiteboardWorks.BizUnitSteps.dll" typeName="WhiteboardWorks.BizUnitSteps.ESBToolkitResolutionContextLoader">
<FactsContextKey>Facts</FactsContextKey>
<DocumentType>Microsoft.Practices.ESB.ResolveProviderMessage</DocumentType>
<SourceDocument>SourceDocument.xml</SourceDocument>
</ContextLoaderStep>
<ValidationStep assemblyPath="WhiteboardWorks.BizUnitSteps.dll" typeName="WhiteboardWorks.BizUnitSteps.ESBToolkitResolutionValidationStep">
<FactsContextKey>Facts</FactsContextKey>
<TransportType>WCF-SQL</TransportType>
<TransportLocation>http://databaseXYZ/ABC</TransportLocation>
<Action>SubmitMessage</Action>
<TargetNamespace>http://xyz/contoso</TargetNamespace>
</ValidationStep>
</TestStep>
The Blog Post Unit Testing BizTalk Business Rule Engine (
http://whiteboardworks.com/2010/03/unit-testing-biztalk-business-rule-engine/ ) also provides additional information.