FluentSpecification.Abstractions
is a abstraction layer for Specification design pattern. Contains also interfaces and structures for validation and Linq scenarios.
Specification
ISpecification<T>
is absolutely base, for all Specifications and extensions, across all FluentSpecification packages.
But there is couple of differences with known Specification design pattern - interface contains only IsSatisfiedBy
method without And, Or etc.
This methods are moved as extensions to the FluentSpecification.Core
.
Thanks that implementation of simple Specification is very easy - you need to implement only IsSatisfiedBy
method.
Every Specifications also implements empty ISpecification
interface - you can represent any kind of Specification regardless of the type.
Validation
For Validation scenarios, IValidationSpecification<T>
is prepared. This interface inherit from ISpecification<T>
.
Contains also IsSatisfiedBy
method but with outer parameter - SpecificationResult
.
In this structure, Specification returns all data related to validation of input candidate. Content of SpecificationResult
is described in next section.
Linq
Specifications, that support Linq expressions, should implement ILinqSpecification<T>
interface.
GetExpression
method returns equivalent of IsSatisfiedBy
method, as Linq expression.
ILinqSpecification<T>
inherit from ISpecification<T>
.
All in one
IComplexSpecification<T>
interface, is prepared for Specifications with support of all functionalities, described above. Every built-in Specifications implements this interface.