Specification.

Cast<T, TProperty, TCast>(ICompositeSpecification<T>, Expression<Func<T, TProperty>>, ISpecification<TCast>) Method

Summary

Composes self Specification with CastSpecification<T, TCast> for candidate property:

Converts Specification (candidate property to verification) from TProperty to TCast.

Namespace
FluentSpecification
Containing Type
Specification

Syntax

[PublicAPI]
[NotNull]
public static IComplexSpecification<T> Cast<T, TProperty, TCast>(this ICompositeSpecification<T> self, Expression<Func<T, TProperty>> selector, ISpecification<TCast> propertySpecification)

Attributes

Type Description
PublicAPI
NotNull

Type Parameters

Name Description
T Type of candidate.
TProperty Type of candidate property to verify.
TCast Type of candidate to verify after cast.

Parameters

Name Type Description
self ICompositeSpecification<T> Self specification.
selector Expression<Func<T, TProperty>> Candidate property selector.
propertySpecification ISpecification<TCast> Specification to convert.

Return Value

Type Description
IComplexSpecification<T> Composed complex Specification.

Exceptions

Type Description
System.ArgumentNullException Thrown when self or selector is null.
System.ArgumentException Thrown when selector is not valid.
System.ArgumentNullException Thrown when propertySpecification is null.
System.InvalidOperationException Thrown when there is no conversion between TProperty and TCast.
GitHub