Documentation
¶
Overview ¶
Package mock implements necessary mocking structures to allow easier testing for the smpp package. Only ReadWriteCloser is currently implemented aimed at mocking network connection.
Index ¶
- type Conn
- func (c *Conn) ByteRead(read []byte) *Conn
- func (c *Conn) ByteWrite(write []byte) *Conn
- func (c *Conn) Close() error
- func (c *Conn) Closed() *Conn
- func (c *Conn) ErrRead(err error) *Conn
- func (c *Conn) ErrWrite(err error) *Conn
- func (c *Conn) NoResp() *Conn
- func (c *Conn) ProcessRead(f func(step, count int) ([]byte, error)) *Conn
- func (c *Conn) ProcessWrite(f func(step, count int) ([]byte, error)) *Conn
- func (c *Conn) Read(out []byte) (int, error)
- func (c *Conn) Times(n int) *Conn
- func (c *Conn) Validate() []error
- func (c *Conn) Wait(s int) *Conn
- func (c *Conn) Write(in []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct { io.ReadWriteCloser // contains filtered or unexported fields }
Conn implements ReadWriteCloser interface and can be used to mock network connection in tests.
func (*Conn) NoResp ¶
NoResp will set connection to not return response for the preceding read/write. Panics if write/read calls are unmatched.
func (*Conn) ProcessRead ¶
ProcessRead provides function to the connection that will process read.
func (*Conn) ProcessWrite ¶
ProcessWrite provides function to the connection that will process writes.
func (*Conn) Validate ¶
Validate will check executed scenario and return any errors in execution. It will return nil if scenario was valid.