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

43 lines
815 B
Go

package mock
import (
"github.com/eventials/goevents/messaging"
"github.com/stretchr/testify/mock"
)
type Consumer struct {
mock.Mock
}
func NewMockConsumer() messaging.Consumer {
return &Consumer{}
}
func (c *Consumer) Subscribe(action string, handler messaging.EventHandler, options *messaging.SubscribeOptions) error {
args := c.Called(action, handler, options)
return args.Error(0)
}
func (c *Consumer) Unsubscribe(action string) error {
args := c.Called(action)
return args.Error(0)
}
func (c *Consumer) Consume() {
c.Called()
}
func (c *Consumer) Close() {
c.Called()
}
func (c *Consumer) BindActions(actions ...string) error {
args := c.Called(actions)
return args.Error(0)
}
func (c *Consumer) UnbindActions(actions ...string) error {
args := c.Called(actions)
return args.Error(0)
}