C# 클래스 Habanero.Testability.BOTestFactory

The BOTestFactory is a factory used to construct a Business Object for testing. The Constructed Business object can be constructed a a valid (i.e. saveable Business object) CreateValidBusinessObject .
A Valid Property Value can also be generated for any particular Prop using one of the overloads of GetValidPropValue(IBOProp), GetValidPropValue(Habanero.Base.ISingleValueDef), GetValidPropValue(Habanero.Base.IBusinessObject,string) GetValidPropValue(System.Type,string).
A Valid Relationship can be generated for any particular relationship using GetValidRelationshipValue.
Although all of these are valid methods of using the BOTestFactory you are most likely to use the Generic BOTestFactory BOTestFactory{TBO} this test factory has even more powerfull mechanisms to use for generating valid Relationship and PropValues.
파일 보기 프로젝트 열기: Chillisoft/habanero.testability 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
_defaultValueRegistry BODefaultValueRegistry
_validValueGenRegistry BOPropValueGeneratorRegistry

공개 메소드들

메소드 설명
BOTestFactory ( Type boType ) : System.Collections

CreateDefaultBusinessObject ( ) : IBusinessObject

Creates a business object with only its default values set (i.e. defaults from its ClassDef).

CreateSavedBusinessObject ( ) : IBusinessObject

Returns a saved valid business object of Type

CreateValidBusinessObject ( ) : IBusinessObject

Creates a business object with all of its compulsory properties and Relationships set to Valid values.

FixInvalidInterPropRules ( IBusinessObject bo ) : void

Fixes a Business object that has been created. I.e. if the Business object has any InterPropRules then these rules are used to ensure that the Property values do not conflict with the InterPropRules.

GetValidPropValue ( IBOProp boProp ) : object

Returns a valid prop value for boProp using any IPropRules for the Prop. Note_ this value does take into consideration any InterPropRules

GetValidPropValue ( IBusinessObject bo, string propName ) : object

Returns a valid prop value for propName for the IBusinessObject using any IPropRules for the Prop and any InterPropRules for the BusinessObject.

GetValidPropValue ( ISingleValueDef propDef ) : object

Returns a valid prop value for propDef using any IPropRules for the Prop. Note_ this value does not take into consideration any InterPropRules

GetValidPropValue ( Type type, string propName ) : object

Returns a valid prop value for propName for the Business object of type type using any IPropRules for the Prop. Note_ this value does nto atake into consideration any InterPropRules

GetValidPropValue ( string propName ) : object

Returns a valid prop value for propName for the Business object using any IPropRules for the Prop. Note_ this value does nto atake into consideration any InterPropRules

GetValidRelationshipValue ( ISingleValueDef relationshipDef ) : IBusinessObject

Returns a Valid Relationship Value for the relationship relationshipDef

GetValidValue ( IBusinessObject bo, string name ) : object

Returns a valid prop value for Property or single relationship with the name name for the IBusinessObject.

GetValidValue ( string name ) : object

Returns a valid Value for either a single relationship or a property for the BusinessObject's relationship or prop is identified by the name

GetValidValueGenerator ( ISingleValueDef propDef ) : ValidValueGenerator

returns a valid value generator for of the specified type based on the ISingleValueDef.ISingleValueDef.PropertyType

SetPropValueToValidValue ( IBOProp boProp ) : void

Sets the value of the IBOProp to a valid value. This is primarily used internally.

SetRelationshipToValidValue ( ISingleRelationship singleRelationship ) : void

Sets the Value of the ISingleRelationship to a valid value.

SetValueFor ( string propertyName, object propertyValue ) : void

Sets the propertyValue for the method Idenfied by the propertyName. This ensures that when the CreateValidBusinessObject or BOTestFactory.UpdateCompulsoryProperties or GetValidPropValue(Habanero.Base.IBOProp) and the GetValidRelationshipValue for this Property this value is always used

UpdateCompulsoryProperties ( IBusinessObject businessObject ) : void

Updates any compulsory relationships or properties for

보호된 메소드들

메소드 설명
CreateBusinessObject ( ) : IBusinessObject
GetPropDef ( IClassDef classDef, string propName, bool raiseErrIfNotExists ) : ISingleValueDef
GetPropDef ( Type type, string propName, bool raiseErrIfNotExists ) : ISingleValueDef
GetRelationshipDef ( Type type, string relationshipName, bool raiseErrIfNotExists ) : IRelationshipDef
GetValidPropValue ( IClassDef classDef, string propName ) : object

Returns a valid prop value for propName for the Business object of type classDef using any IPropRules for the Prop. Note_ this value does nto atake into consideration any InterPropRules

GetValidRelationshipValue ( Type type, string relationshipName ) : IBusinessObject

Returns a valid Relationship for the BusinessObject's relationship identified by the relationshipName

ValidateClassDef ( Type type ) : void
ValidateRelationshipDef ( Type type, IRelationshipDef def, string relationshipName ) : void

비공개 메소드들

메소드 설명
GetBusinessObjectRules ( IBusinessObject bo ) : IEnumerable
GetValidValue ( Type type, string name ) : object

Returns a valid Value for either a single relationship or a property for the BusinessObject's relationship or prop is identified by the name

IsNotWriteNotNew ( ISingleValueDef propDef ) : bool
MustCreateSinglePropValue ( ISingleRelationship singleRelationship ) : bool
SetRelationshipToValidValue ( IMultipleRelationship multipleRelationship ) : void

Sets the Value of the IMultipleRelationship to a list of values as configured using the WithMany.

ThrowPropDoesNotExist ( Type type, string name ) : void
UpdatePrimaryKeyProps ( IBusinessObject businessObject ) : void
UpdateProperties ( IBusinessObject businessObject ) : void
UpdateSingleRelationships ( IBusinessObject businessObject ) : void
UpdatedManyRelationships ( IBusinessObject businessObject ) : void
ValidateProp ( Type type, ISingleValueDef def, string propName ) : void

메소드 상세

BOTestFactory() 공개 메소드

public BOTestFactory ( Type boType ) : System.Collections
boType System.Type
리턴 System.Collections

CreateBusinessObject() 보호된 메소드

protected CreateBusinessObject ( ) : IBusinessObject
리턴 IBusinessObject

CreateDefaultBusinessObject() 공개 메소드

Creates a business object with only its default values set (i.e. defaults from its ClassDef).
public CreateDefaultBusinessObject ( ) : IBusinessObject
리턴 IBusinessObject

CreateSavedBusinessObject() 공개 메소드

Returns a saved valid business object of Type
public CreateSavedBusinessObject ( ) : IBusinessObject
리턴 IBusinessObject

CreateValidBusinessObject() 공개 메소드

Creates a business object with all of its compulsory properties and Relationships set to Valid values.
public CreateValidBusinessObject ( ) : IBusinessObject
리턴 IBusinessObject

FixInvalidInterPropRules() 공개 메소드

Fixes a Business object that has been created. I.e. if the Business object has any InterPropRules then these rules are used to ensure that the Property values do not conflict with the InterPropRules.
public FixInvalidInterPropRules ( IBusinessObject bo ) : void
bo IBusinessObject
리턴 void

GetPropDef() 보호된 정적인 메소드

protected static GetPropDef ( IClassDef classDef, string propName, bool raiseErrIfNotExists ) : ISingleValueDef
classDef IClassDef
propName string
raiseErrIfNotExists bool
리턴 ISingleValueDef

GetPropDef() 보호된 정적인 메소드

protected static GetPropDef ( Type type, string propName, bool raiseErrIfNotExists ) : ISingleValueDef
type System.Type
propName string
raiseErrIfNotExists bool
리턴 ISingleValueDef

GetRelationshipDef() 보호된 정적인 메소드

protected static GetRelationshipDef ( Type type, string relationshipName, bool raiseErrIfNotExists ) : IRelationshipDef
type System.Type
relationshipName string
raiseErrIfNotExists bool
리턴 IRelationshipDef

GetValidPropValue() 공개 메소드

Returns a valid prop value for boProp using any IPropRules for the Prop. Note_ this value does take into consideration any InterPropRules
public GetValidPropValue ( IBOProp boProp ) : object
boProp IBOProp
리턴 object

GetValidPropValue() 공개 메소드

Returns a valid prop value for propName for the IBusinessObject using any IPropRules for the Prop and any InterPropRules for the BusinessObject.
public GetValidPropValue ( IBusinessObject bo, string propName ) : object
bo IBusinessObject
propName string
리턴 object

GetValidPropValue() 보호된 메소드

Returns a valid prop value for propName for the Business object of type classDef using any IPropRules for the Prop. Note_ this value does nto atake into consideration any InterPropRules
protected GetValidPropValue ( IClassDef classDef, string propName ) : object
classDef IClassDef
propName string
리턴 object

GetValidPropValue() 공개 메소드

Returns a valid prop value for propDef using any IPropRules for the Prop. Note_ this value does not take into consideration any InterPropRules
public GetValidPropValue ( ISingleValueDef propDef ) : object
propDef ISingleValueDef
리턴 object

GetValidPropValue() 공개 메소드

Returns a valid prop value for propName for the Business object of type type using any IPropRules for the Prop. Note_ this value does nto atake into consideration any InterPropRules
public GetValidPropValue ( Type type, string propName ) : object
type System.Type
propName string
리턴 object

GetValidPropValue() 공개 메소드

Returns a valid prop value for propName for the Business object using any IPropRules for the Prop. Note_ this value does nto atake into consideration any InterPropRules
public GetValidPropValue ( string propName ) : object
propName string
리턴 object

GetValidRelationshipValue() 공개 메소드

Returns a Valid Relationship Value for the relationship relationshipDef
public GetValidRelationshipValue ( ISingleValueDef relationshipDef ) : IBusinessObject
relationshipDef ISingleValueDef
리턴 IBusinessObject

GetValidRelationshipValue() 보호된 메소드

Returns a valid Relationship for the BusinessObject's relationship identified by the relationshipName
protected GetValidRelationshipValue ( Type type, string relationshipName ) : IBusinessObject
type System.Type
relationshipName string
리턴 IBusinessObject

GetValidValue() 공개 메소드

Returns a valid prop value for Property or single relationship with the name name for the IBusinessObject.
public GetValidValue ( IBusinessObject bo, string name ) : object
bo IBusinessObject
name string
리턴 object

GetValidValue() 공개 메소드

Returns a valid Value for either a single relationship or a property for the BusinessObject's relationship or prop is identified by the name
public GetValidValue ( string name ) : object
name string
리턴 object

GetValidValueGenerator() 공개 메소드

returns a valid value generator for of the specified type based on the ISingleValueDef.ISingleValueDef.PropertyType
public GetValidValueGenerator ( ISingleValueDef propDef ) : ValidValueGenerator
propDef ISingleValueDef
리턴 ValidValueGenerator

SetPropValueToValidValue() 공개 메소드

Sets the value of the IBOProp to a valid value. This is primarily used internally.
public SetPropValueToValidValue ( IBOProp boProp ) : void
boProp IBOProp
리턴 void

SetRelationshipToValidValue() 공개 메소드

Sets the Value of the ISingleRelationship to a valid value.
public SetRelationshipToValidValue ( ISingleRelationship singleRelationship ) : void
singleRelationship ISingleRelationship
리턴 void

SetValueFor() 공개 메소드

Sets the propertyValue for the method Idenfied by the propertyName. This ensures that when the CreateValidBusinessObject or BOTestFactory.UpdateCompulsoryProperties or GetValidPropValue(Habanero.Base.IBOProp) and the GetValidRelationshipValue for this Property this value is always used
public SetValueFor ( string propertyName, object propertyValue ) : void
propertyName string
propertyValue object
리턴 void

UpdateCompulsoryProperties() 공개 메소드

Updates any compulsory relationships or properties for
public UpdateCompulsoryProperties ( IBusinessObject businessObject ) : void
businessObject IBusinessObject
리턴 void

ValidateClassDef() 보호된 정적인 메소드

protected static ValidateClassDef ( Type type ) : void
type System.Type
리턴 void

ValidateRelationshipDef() 보호된 정적인 메소드

protected static ValidateRelationshipDef ( Type type, IRelationshipDef def, string relationshipName ) : void
type System.Type
def IRelationshipDef
relationshipName string
리턴 void

프로퍼티 상세

_defaultValueRegistry 보호되어 있는 프로퍼티

protected BODefaultValueRegistry,Habanero.Testability _defaultValueRegistry
리턴 BODefaultValueRegistry

_validValueGenRegistry 보호되어 있는 프로퍼티

protected BOPropValueGeneratorRegistry,Habanero.Testability _validValueGenRegistry
리턴 BOPropValueGeneratorRegistry