-
Notifications
You must be signed in to change notification settings - Fork 198
/
gasScheduleNotifierMock.go
56 lines (45 loc) · 1.47 KB
/
gasScheduleNotifierMock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package testscommon
import "github.com/ElrondNetwork/elrond-go-core/core"
// GasScheduleNotifierMock -
type GasScheduleNotifierMock struct {
GasSchedule map[string]map[string]uint64
RegisterNotifyHandlerCalled func(handler core.GasScheduleSubscribeHandler)
LatestGasScheduleCalled func() map[string]map[string]uint64
LatestGasScheduleCopyCalled func() map[string]map[string]uint64
}
// NewGasScheduleNotifierMock -
func NewGasScheduleNotifierMock(gasSchedule map[string]map[string]uint64) *GasScheduleNotifierMock {
g := &GasScheduleNotifierMock{
GasSchedule: gasSchedule,
}
return g
}
// RegisterNotifyHandler -
func (g *GasScheduleNotifierMock) RegisterNotifyHandler(handler core.GasScheduleSubscribeHandler) {
if g.RegisterNotifyHandlerCalled != nil {
g.RegisterNotifyHandlerCalled(handler)
return
}
handler.GasScheduleChange(g.GasSchedule)
}
// LatestGasSchedule -
func (g *GasScheduleNotifierMock) LatestGasSchedule() map[string]map[string]uint64 {
if g.LatestGasScheduleCalled != nil {
return g.LatestGasScheduleCalled()
}
return g.GasSchedule
}
// LatestGasScheduleCopy -
func (g *GasScheduleNotifierMock) LatestGasScheduleCopy() map[string]map[string]uint64 {
if g.LatestGasScheduleCopyCalled != nil {
return g.LatestGasScheduleCopyCalled()
}
return g.GasSchedule
}
// UnRegisterAll -
func (g *GasScheduleNotifierMock) UnRegisterAll() {
}
// IsInterfaceNil -
func (g *GasScheduleNotifierMock) IsInterfaceNil() bool {
return g == nil
}