mock_driver

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareRequestNumber

func CompareRequestNumber(pk CreditControlRequestPK, expected *wrappers.Int32Value, actual datatype.Unsigned32) error

func EqualWithinDelta

func EqualWithinDelta(a, b, delta uint64) bool

Types

type CreditControlRequestPK

type CreditControlRequestPK struct {
	// contains filtered or unexported fields
}

func NewCCRequestPK

func NewCCRequestPK(imsi string, requestType protos.CCRequestType) CreditControlRequestPK

func (CreditControlRequestPK) String

func (r CreditControlRequestPK) String() string

type Expectation

type Expectation interface {
	DoesMatch(interface{}) error
	GetAnswer() interface{}
}

type MockDriver

type MockDriver struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewMockDriver

func NewMockDriver(expectations []Expectation, behavior protos.UnexpectedRequestBehavior, defaultAnswer interface{}) *MockDriver

func (*MockDriver) AggregateResults

func (e *MockDriver) AggregateResults() ([]*protos.ExpectationResult, []*protos.ErrorByIndex)

AggregateResults will aggregate resultByIndex and errorsByIndex.

func (*MockDriver) GetAnswerFromExpectations

func (e *MockDriver) GetAnswerFromExpectations(message interface{}) interface{}

GetAnswerFromExpectations will use the message passed in to determine if the message matches the next upcoming expectation. If it does, it will return the answer specified in the expectation. Otherwise, if the unexpected request behavior is set to CONTINUE_WITH_DEFAULT_ANSWER, it will return the default answer. Otherwise, it will return nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL