Pact C++ Consumer DSL  0.0.7
DSL to support writing consumer tests in C++
Public Member Functions | Public Attributes | List of all members
pact_consumer::Pact Class Reference

#include <consumer.h>

Public Member Functions

 Pact (const char *consumer, const char *provider)
 
Interaction given (const char *provider_state) const
 
Interaction given (const char *provider_state, const std::unordered_map< std::string, std::string > &parameters) const
 
Interaction uponReceiving (const char *description) const
 
PactTestResult run_test (std::function< bool(const MockServerHandle *)> callback) const
 

Public Attributes

PactHandle pact
 
std::string pact_directory
 

Detailed Description

Class that defines a Pact between a consumer and provider

Constructor & Destructor Documentation

◆ Pact()

pact_consumer::Pact::Pact ( const char *  consumer,
const char *  provider 
)

Constructs the Pact given the consumer and provider names

Member Function Documentation

◆ given() [1/2]

Interaction pact_consumer::Pact::given ( const char *  provider_state) const

Creates a new iteraction with a defined provider state

◆ given() [2/2]

Interaction pact_consumer::Pact::given ( const char *  provider_state,
const std::unordered_map< std::string, std::string > &  parameters 
) const

Creates a new iteraction with a defined provider state and parameters

◆ run_test()

PactTestResult pact_consumer::Pact::run_test ( std::function< bool(const MockServerHandle *)>  callback) const

Starts a mock server for this pact, and then passes it to the callback. The callback needs to return a boolean value to indicate of the test was successful.

◆ uponReceiving()

Interaction pact_consumer::Pact::uponReceiving ( const char *  description) const

Creates a new interaction with the provided description.

Member Data Documentation

◆ pact

PactHandle pact_consumer::Pact::pact

◆ pact_directory

std::string pact_consumer::Pact::pact_directory

Directory to write pact files to


The documentation for this class was generated from the following files: