Specification.

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

Summary

Creates 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>(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
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 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