1
0
mirror of https://github.com/eventials/goevents.git synced 2025-05-01 13:48:56 +08:00
eventials.goevents/mock/consumer.go

33 lines
593 B
Go
Raw Normal View History

2016-12-01 11:40:58 -02:00
package mock
import (
"github.com/eventials/goevents/messaging"
"github.com/stretchr/testify/mock"
)
type Consumer struct {
mock.Mock
}
2017-10-05 14:55:13 -03:00
func NewMockConsumer() messaging.Consumer {
return &Consumer{}
}
2017-10-05 16:22:28 -03:00
func (c *Consumer) Subscribe(action string, handler messaging.EventHandler, options *messaging.SubscribeOptions) error {
args := c.Called(action, handler, options)
2017-10-05 14:55:13 -03:00
return args.Error(0)
2016-12-01 11:40:58 -02:00
}
func (c *Consumer) Unsubscribe(action string) error {
args := c.Called(action)
2017-10-05 14:55:13 -03:00
return args.Error(0)
2016-12-01 11:40:58 -02:00
}
2017-10-05 14:55:13 -03:00
func (c *Consumer) Consume() {
c.Called()
2016-12-01 11:40:58 -02:00
}
2017-10-05 14:55:13 -03:00
func (c *Consumer) Close() {
c.Called()
2016-12-01 11:40:58 -02:00
}