C# Class KernowCode.KTest.Ubaddas.Behaviour

Main UBADDAS behaviour logic, providing fluent interface
Inheritance: IBase, IGiven, IWhen, IThen, IState, ISet
显示文件 Open project: KernowCode/UBADDAS Class Usage Examples

Public Methods

Method Description
GetTestFilename ( string format = "{0}" ) : string

Creates a filename based on test method name

Given ( System.Action domainEntityCommand = null ) : IGiven

Specifies the start of the 'Given' section of BDD

This can be followed by 'And' and 'When'

It must be preceeded by 'As'

Example

.Given(customer.Login)

.Given() //nothing

GivenWe ( Action actionDelegate ) : IGiven

Specifies the start of the 'Given' section of BDD

This can be followed by 'And' and 'When'

It must be preceeded by 'As'

Example

.GivenWe(x => RegisterCustomer(x, customer))

Perform ( ) : IBase

Used when you create a method to perform an inner set of behaviours

Example

behaviour.Perform()

.Given(...

SoThat ( string businessValue, string targetApplicationLayer, object appRunner, Loggers loggers, System.Action preStepAction = null ) : Behaviour

New behaviour factory method

Then ( System.Action domainEntityCommand ) : IThen

Specifies the start of the 'Then' section of BDD

This can be followed by 'And'

Example

.Then(customer.Logout)

ThenWe ( Action actionDelegate ) : IThen

Specifies the start of the 'Then' section of BDD

This can be followed by 'And'

Example

.ThenWe(x => CheckAllOrders(x, customer))

When ( System.Action domainEntityCommand ) : IWhen

Specifies the start of the 'When' section of BDD

This can be followed by 'And' and 'Then'

Example

.When(customer.Login)

WhenWe ( Action actionDelegate ) : IWhen

Specifies the start of the 'When' section of BDD

This can be followed by 'And' and 'Then'

Example

.WhenWe(x => CompleteCustomerRegistration(x, customer))

Private Methods

Method Description
AddPrefix ( string reason ) : string
As ( IPersona persona ) : void
Behaviour ( string targetApplicationLayer, object appRunner, Loggers loggers, string testName, string businessValue, System.Action preStepAction = null ) : System
CleanFileName ( string fileName ) : string
CreatePersonaImplementation ( ) : object
Do ( System.Action action ) : void
DoBehaviour ( string behaviour, System.Action domainEntityCommand ) : void
DoBehaviourSet ( string behaviour, Action actionDelegate ) : void
GetPersonaImplementedMethod ( System.Action domainEntityCommand ) : MethodInfo
GetPersonaLayerType ( IPersona persona ) : Type
GetTestMethod ( ) : MethodBase
GetTestName ( ) : string
Log ( System.Action action ) : void
SetAppRunnerOnPersonaImplementation ( object persona, object appRunner ) : void
SetDomainOnPersonaImplementation ( System.Action domainEntityCommand, object persona ) : void
SetLoggerOnPersonaImplementation ( object persona, Loggers loggers ) : void
SetVerbOnPersonaImplementation ( object persona, Verb verb ) : void
getInterfaceNameOfMethod ( MethodInfo concreteMethod ) : string

Method Details

GetTestFilename() public static method

Creates a filename based on test method name
public static GetTestFilename ( string format = "{0}" ) : string
format string Specify a string format if required to enrich filename
return string

Given() public method

Specifies the start of the 'Given' section of BDD

This can be followed by 'And' and 'When'

It must be preceeded by 'As'

Example

.Given(customer.Login)

.Given() //nothing

public Given ( System.Action domainEntityCommand = null ) : IGiven
domainEntityCommand System.Action The entitiy interface command method (without executing parenthesis)
return IGiven

GivenWe() public method

Specifies the start of the 'Given' section of BDD

This can be followed by 'And' and 'When'

It must be preceeded by 'As'

Example

.GivenWe(x => RegisterCustomer(x, customer))

public GivenWe ( Action actionDelegate ) : IGiven
actionDelegate Action A delegate containing a call to a method that will execute another set of behaviours. Specify 'ISet behaviour' as the first parameter of your method and use behaviour to perform another Given,When,Then
return IGiven

Perform() public method

Used when you create a method to perform an inner set of behaviours

Example

behaviour.Perform()

.Given(...

public Perform ( ) : IBase
return IBase

SoThat() public static method

New behaviour factory method
public static SoThat ( string businessValue, string targetApplicationLayer, object appRunner, Loggers loggers, System.Action preStepAction = null ) : Behaviour
businessValue string text describing the business value
targetApplicationLayer string project folder name containing target test class implementations
appRunner object your page object model instance or other to operate the application
loggers KernowCode.KTest.Logging.Loggers instance of loggers
preStepAction System.Action
return Behaviour

Then() public method

Specifies the start of the 'Then' section of BDD

This can be followed by 'And'

Example

.Then(customer.Logout)

public Then ( System.Action domainEntityCommand ) : IThen
domainEntityCommand System.Action The entitiy interface command method (without executing parenthesis)
return IThen

ThenWe() public method

Specifies the start of the 'Then' section of BDD

This can be followed by 'And'

Example

.ThenWe(x => CheckAllOrders(x, customer))

public ThenWe ( Action actionDelegate ) : IThen
actionDelegate Action A delegate containing a call to a method that will execute another set of behaviours. Specify 'ISet behaviour' as the first parameter of your method and use behaviour to perform another Given,When,Then
return IThen

When() public method

Specifies the start of the 'When' section of BDD

This can be followed by 'And' and 'Then'

Example

.When(customer.Login)

public When ( System.Action domainEntityCommand ) : IWhen
domainEntityCommand System.Action The entitiy interface command method (without executing parenthesis)
return IWhen

WhenWe() public method

Specifies the start of the 'When' section of BDD

This can be followed by 'And' and 'Then'

Example

.WhenWe(x => CompleteCustomerRegistration(x, customer))

public WhenWe ( Action actionDelegate ) : IWhen
actionDelegate Action A delegate containing a call to a method that will execute another set of behaviours. Specify 'ISet behaviour' as the first parameter of your method and use behaviour to perform another Given,When,Then
return IWhen