C# Class Habanero.Testability.BOPropValueGeneratorRegistry

This is a registry of the ValidValueGenerators Registered for a specific PropertyDefinition ISingleValueDef of a particular Property for a specified Business Object type. This was creates so as to allow the Developer to override the Generic ValidValueGenerator.
E.g. if the Business object Property has specific rules or things that must be set to ensure that it is a valid saveable business object. Then you can register a specialised Valid Value Generator that will generate the appropriate value for that Business Object Property.
This is also used behind the scenes when you want to generate a business object with a specified non compulsory property in a particular case. Then a Valid Value Generator is registered for that ISingleValueDef and the non compulsory prop will have a value set. For more details see BOTestFactory
Datei anzeigen Open project: Chillisoft/habanero.testability

Public Methods

Method Description
ClearAll ( ) : void

Clears all ValidValue Generators registered.

IsRegistered ( ISingleValueDef propDef ) : bool

Returns True if a value Gen is registered with the singleValueDef propDef

Register ( ISingleValueDef propDef, Type validValuGenType, object parameter = null ) : void

Register a Valid Value Generator to be used for generating values for a specified PropDef.

Resolve ( ISingleValueDef propDef ) : ValidValueGenerator

Resolves the registered ValidValueGenerator for the PropDef if one is registered. Else tries to find a ValidValueGenerator for the specified PropDefs Property Type using the ValidValueGeneratorRegistry

Private Methods

Method Description
ClearPreviousInstances ( ISingleValueDef propDef ) : void
GeneratorHasConstructorWithExtraParameter ( Type validValueGenType ) : bool
GetClassType ( ISingleValueDef propDef ) : string
GetKeyName ( ISingleValueDef propDef ) : string
ValidateGeneratorType ( Type factoryType, string typeName ) : void

Method Details

ClearAll() public method

Clears all ValidValue Generators registered.
public ClearAll ( ) : void
return void

IsRegistered() public method

Returns True if a value Gen is registered with the singleValueDef propDef
public IsRegistered ( ISingleValueDef propDef ) : bool
propDef ISingleValueDef
return bool

Register() public method

Register a Valid Value Generator to be used for generating values for a specified PropDef.
public Register ( ISingleValueDef propDef, Type validValuGenType, object parameter = null ) : void
propDef ISingleValueDef The property definition for which this generator type is being assigned
validValuGenType Type The type of generator which will be instantiated when a valid value is needed
parameter object An additional parameter to pass to the constructor of the generator
return void

Resolve() public method

Resolves the registered ValidValueGenerator for the PropDef if one is registered. Else tries to find a ValidValueGenerator for the specified PropDefs Property Type using the ValidValueGeneratorRegistry
public Resolve ( ISingleValueDef propDef ) : ValidValueGenerator
propDef ISingleValueDef
return ValidValueGenerator