Class TapExtensions
- Namespace
- Motiv
- Assembly
- Motiv.dll
Provides extension methods for attaching side-effects to specifications without altering their logical behavior.
public static class TapExtensions
- Inheritance
-
TapExtensions
- Inherited Members
Methods
TapWhenFalse<TModel, TMetadata>(SpecBase<TModel, TMetadata>, Action<TModel, BooleanResultBase<TMetadata>>)
Wraps a specification so that a callback fires only when the evaluation is not satisfied.
public static SpecBase<TModel, TMetadata> TapWhenFalse<TModel, TMetadata>(this SpecBase<TModel, TMetadata> spec, Action<TModel, BooleanResultBase<TMetadata>> callback)
Parameters
specSpecBase<TModel, TMetadata>The specification to wrap.
callbackAction<TModel, BooleanResultBase<TMetadata>>The callback to invoke when the result is not satisfied.
Returns
- SpecBase<TModel, TMetadata>
A new specification that transparently wraps the original, firing the callback when not satisfied.
Type Parameters
TModelThe model type.
TMetadataThe metadata type.
TapWhenTrue<TModel, TMetadata>(SpecBase<TModel, TMetadata>, Action<TModel, BooleanResultBase<TMetadata>>)
Wraps a specification so that a callback fires only when the evaluation is satisfied.
public static SpecBase<TModel, TMetadata> TapWhenTrue<TModel, TMetadata>(this SpecBase<TModel, TMetadata> spec, Action<TModel, BooleanResultBase<TMetadata>> callback)
Parameters
specSpecBase<TModel, TMetadata>The specification to wrap.
callbackAction<TModel, BooleanResultBase<TMetadata>>The callback to invoke when the result is satisfied.
Returns
- SpecBase<TModel, TMetadata>
A new specification that transparently wraps the original, firing the callback when satisfied.
Type Parameters
TModelThe model type.
TMetadataThe metadata type.
Tap<TModel, TMetadata>(SpecBase<TModel, TMetadata>, Action<TModel, BooleanResultBase<TMetadata>>)
Wraps a specification so that a callback fires on every evaluation. The callback receives the model and the result, but the result itself is returned unchanged.
public static SpecBase<TModel, TMetadata> Tap<TModel, TMetadata>(this SpecBase<TModel, TMetadata> spec, Action<TModel, BooleanResultBase<TMetadata>> callback)
Parameters
specSpecBase<TModel, TMetadata>The specification to wrap.
callbackAction<TModel, BooleanResultBase<TMetadata>>The callback to invoke on every evaluation.
Returns
- SpecBase<TModel, TMetadata>
A new specification that transparently wraps the original, firing the callback on evaluation.
Type Parameters
TModelThe model type.
TMetadataThe metadata type.