Skip to main content
Version: 0.3.x (0.3.0)

Class ValueObjectArbMapExtensions

Namespace: AdCodicem.ValueObjects.FsCheck
Assembly: AdCodicem.ValueObjects.FsCheck.dll

Merges the arbitraries of value objects into an FsCheck map, one per type, so that the map derives the types that hold them too.

public static class ValueObjectArbMapExtensions

Inheritance​

object ← ValueObjectArbMapExtensions

Inherited Members​

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Remarks​

Each value object is merged with MergeArb on its own arbitrary, , closed over it through its descriptor's visitor: a single factory constrained to value objects would break the derivation of every other type the map serves.

Methods​

MergeValueObject<TSelf, TValue>(IArbMap, ValueObjectSamplerOptions?)​

Merges the arbitrary of one value object: a construction of a generic one, or one written by hand that nothing registers.

public static IArbMap MergeValueObject<TSelf, TValue>(this IArbMap map, ValueObjectSamplerOptions? options = null) where TSelf : struct, IValueObject<TSelf, TValue>

Parameters​

map IArbMap

The map to merge into.

options ValueObjectSamplerOptions?

How each value is drawn, or null for the defaults.

Returns​

IArbMap

The merged map.

Type Parameters​

TSelf

The value object.

TValue

Its underlying type.

Exceptions​

ArgumentNullException

map is null.

MergeValueObjects(IArbMap, Assembly, ValueObjectSamplerOptions?)​

Merges the arbitrary of every value object the generated registration of an assembly registers, and of every other value object of that assembly the registry holds by then but a construction of a generic one.

[RequiresUnreferencedCode("Locates the generated registration of the assembly by its metadata.")]
public static IArbMap MergeValueObjects(this IArbMap map, Assembly assembly, ValueObjectSamplerOptions? options = null)

Parameters​

map IArbMap

The map to merge into: ArbMap.Default, or one already merged.

assembly Assembly

The assembly declaring the value objects: typeof(Iban).Assembly.

options ValueObjectSamplerOptions?

How each value is drawn, the generators of the rules no schema carries included, or null for the defaults.

Returns​

IArbMap

The merged map.

Remarks​

The constructions of a generic value object, Reference<PurchaseOrder> for one, are not merged, even one the registry described by then, and neither is a value object written by hand that nothing registered or resolved: merge each with . Without it, FsCheck refuses the type, and every type holding it, with its own message, "not handled automatically", naming it. The assembly is not searched through the registry's TryResolve, which would describe and keep every value object written by hand it declares.

Exceptions​

ArgumentNullException

map or assembly is null.