Documentation ¶
Index ¶
- type NeighborMock
- func (mock *NeighborMock) AddTransaction(request neighborhood.TransactionRequest) error
- func (mock *NeighborMock) AddTransactionCalls() []struct{ ... }
- func (mock *NeighborMock) GetAmount(request neighborhood.AmountRequest) (*neighborhood.AmountResponse, error)
- func (mock *NeighborMock) GetAmountCalls() []struct{ ... }
- func (mock *NeighborMock) GetBlocks() ([]*neighborhood.BlockResponse, error)
- func (mock *NeighborMock) GetBlocksCalls() []struct{}
- func (mock *NeighborMock) GetTransactions() ([]neighborhood.TransactionResponse, error)
- func (mock *NeighborMock) GetTransactionsCalls() []struct{}
- func (mock *NeighborMock) Ip() string
- func (mock *NeighborMock) IpCalls() []struct{}
- func (mock *NeighborMock) Mine() error
- func (mock *NeighborMock) MineCalls() []struct{}
- func (mock *NeighborMock) Port() uint16
- func (mock *NeighborMock) PortCalls() []struct{}
- func (mock *NeighborMock) SendTargets(request []neighborhood.TargetRequest) error
- func (mock *NeighborMock) SendTargetsCalls() []struct{ ... }
- func (mock *NeighborMock) StartMining() error
- func (mock *NeighborMock) StartMiningCalls() []struct{}
- func (mock *NeighborMock) StopMining() error
- func (mock *NeighborMock) StopMiningCalls() []struct{}
- func (mock *NeighborMock) Target() string
- func (mock *NeighborMock) TargetCalls() []struct{}
- type RegistryMock
- type SynchronizerMock
- type TimeMock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NeighborMock ¶
type NeighborMock struct { // AddTransactionFunc mocks the AddTransaction method. AddTransactionFunc func(request neighborhood.TransactionRequest) error // GetAmountFunc mocks the GetAmount method. GetAmountFunc func(request neighborhood.AmountRequest) (*neighborhood.AmountResponse, error) // GetBlocksFunc mocks the GetBlocks method. GetBlocksFunc func() ([]*neighborhood.BlockResponse, error) // GetTransactionsFunc mocks the GetTransactions method. GetTransactionsFunc func() ([]neighborhood.TransactionResponse, error) // IpFunc mocks the Ip method. IpFunc func() string // MineFunc mocks the Mine method. MineFunc func() error // PortFunc mocks the Port method. PortFunc func() uint16 // SendTargetsFunc mocks the SendTargets method. SendTargetsFunc func(request []neighborhood.TargetRequest) error // StartMiningFunc mocks the StartMining method. StartMiningFunc func() error // StopMiningFunc mocks the StopMining method. StopMiningFunc func() error // TargetFunc mocks the Target method. TargetFunc func() string // contains filtered or unexported fields }
NeighborMock is a mock implementation of Neighbor.
func TestSomethingThatUsesNeighbor(t *testing.T) { // make and configure a mocked Neighbor mockedNeighbor := &NeighborMock{ AddTransactionFunc: func(request TransactionRequest) error { panic("mock out the AddTransaction method") }, GetAmountFunc: func(request AmountRequest) (*AmountResponse, error) { panic("mock out the GetAmount method") }, GetBlocksFunc: func() ([]*BlockResponse, error) { panic("mock out the GetBlocks method") }, GetTransactionsFunc: func() ([]TransactionResponse, error) { panic("mock out the GetTransactions method") }, IpFunc: func() string { panic("mock out the Ip method") }, MineFunc: func() error { panic("mock out the Mine method") }, PortFunc: func() uint16 { panic("mock out the Port method") }, SendTargetsFunc: func(request []TargetRequest) error { panic("mock out the SendTargets method") }, StartMiningFunc: func() error { panic("mock out the StartMining method") }, StopMiningFunc: func() error { panic("mock out the StopMining method") }, TargetFunc: func() string { panic("mock out the Target method") }, } // use mockedNeighbor in code that requires Neighbor // and then make assertions. }
func (*NeighborMock) AddTransaction ¶
func (mock *NeighborMock) AddTransaction(request neighborhood.TransactionRequest) error
AddTransaction calls AddTransactionFunc.
func (*NeighborMock) AddTransactionCalls ¶
func (mock *NeighborMock) AddTransactionCalls() []struct { Request neighborhood.TransactionRequest }
AddTransactionCalls gets all the calls that were made to AddTransaction. Check the length with:
len(mockedNeighbor.AddTransactionCalls())
func (*NeighborMock) GetAmount ¶
func (mock *NeighborMock) GetAmount(request neighborhood.AmountRequest) (*neighborhood.AmountResponse, error)
GetAmount calls GetAmountFunc.
func (*NeighborMock) GetAmountCalls ¶
func (mock *NeighborMock) GetAmountCalls() []struct { Request neighborhood.AmountRequest }
GetAmountCalls gets all the calls that were made to GetAmount. Check the length with:
len(mockedNeighbor.GetAmountCalls())
func (*NeighborMock) GetBlocks ¶
func (mock *NeighborMock) GetBlocks() ([]*neighborhood.BlockResponse, error)
GetBlocks calls GetBlocksFunc.
func (*NeighborMock) GetBlocksCalls ¶
func (mock *NeighborMock) GetBlocksCalls() []struct { }
GetBlocksCalls gets all the calls that were made to GetBlocks. Check the length with:
len(mockedNeighbor.GetBlocksCalls())
func (*NeighborMock) GetTransactions ¶
func (mock *NeighborMock) GetTransactions() ([]neighborhood.TransactionResponse, error)
GetTransactions calls GetTransactionsFunc.
func (*NeighborMock) GetTransactionsCalls ¶
func (mock *NeighborMock) GetTransactionsCalls() []struct { }
GetTransactionsCalls gets all the calls that were made to GetTransactions. Check the length with:
len(mockedNeighbor.GetTransactionsCalls())
func (*NeighborMock) IpCalls ¶
func (mock *NeighborMock) IpCalls() []struct { }
IpCalls gets all the calls that were made to Ip. Check the length with:
len(mockedNeighbor.IpCalls())
func (*NeighborMock) MineCalls ¶
func (mock *NeighborMock) MineCalls() []struct { }
MineCalls gets all the calls that were made to Mine. Check the length with:
len(mockedNeighbor.MineCalls())
func (*NeighborMock) PortCalls ¶
func (mock *NeighborMock) PortCalls() []struct { }
PortCalls gets all the calls that were made to Port. Check the length with:
len(mockedNeighbor.PortCalls())
func (*NeighborMock) SendTargets ¶
func (mock *NeighborMock) SendTargets(request []neighborhood.TargetRequest) error
SendTargets calls SendTargetsFunc.
func (*NeighborMock) SendTargetsCalls ¶
func (mock *NeighborMock) SendTargetsCalls() []struct { Request []neighborhood.TargetRequest }
SendTargetsCalls gets all the calls that were made to SendTargets. Check the length with:
len(mockedNeighbor.SendTargetsCalls())
func (*NeighborMock) StartMining ¶
func (mock *NeighborMock) StartMining() error
StartMining calls StartMiningFunc.
func (*NeighborMock) StartMiningCalls ¶
func (mock *NeighborMock) StartMiningCalls() []struct { }
StartMiningCalls gets all the calls that were made to StartMining. Check the length with:
len(mockedNeighbor.StartMiningCalls())
func (*NeighborMock) StopMining ¶
func (mock *NeighborMock) StopMining() error
StopMining calls StopMiningFunc.
func (*NeighborMock) StopMiningCalls ¶
func (mock *NeighborMock) StopMiningCalls() []struct { }
StopMiningCalls gets all the calls that were made to StopMining. Check the length with:
len(mockedNeighbor.StopMiningCalls())
func (*NeighborMock) TargetCalls ¶
func (mock *NeighborMock) TargetCalls() []struct { }
TargetCalls gets all the calls that were made to Target. Check the length with:
len(mockedNeighbor.TargetCalls())
type RegistryMock ¶
type RegistryMock struct { // IsRegisteredFunc mocks the IsRegistered method. IsRegisteredFunc func(address string) (bool, error) // contains filtered or unexported fields }
RegistryMock is a mock implementation of Registry.
func TestSomethingThatUsesRegistry(t *testing.T) { // make and configure a mocked Registry mockedRegistry := &RegistryMock{ IsRegisteredFunc: func(address string) (bool, error) { panic("mock out the IsRegistered method") }, } // use mockedRegistry in code that requires Registry // and then make assertions. }
func (*RegistryMock) IsRegistered ¶
func (mock *RegistryMock) IsRegistered(address string) (bool, error)
IsRegistered calls IsRegisteredFunc.
func (*RegistryMock) IsRegisteredCalls ¶
func (mock *RegistryMock) IsRegisteredCalls() []struct { Address string }
IsRegisteredCalls gets all the calls that were made to IsRegistered. Check the length with:
len(mockedRegistry.IsRegisteredCalls())
type SynchronizerMock ¶
type SynchronizerMock struct { // NeighborsFunc mocks the Neighbors method. NeighborsFunc func() []neighborhood.Neighbor // contains filtered or unexported fields }
SynchronizerMock is a mock implementation of Synchronizer.
func TestSomethingThatUsesSynchronizer(t *testing.T) { // make and configure a mocked Synchronizer mockedSynchronizer := &SynchronizerMock{ NeighborsFunc: func() []neighborhood.Neighbor { panic("mock out the Neighbors method") }, } // use mockedSynchronizer in code that requires Synchronizer // and then make assertions. }
func (*SynchronizerMock) Neighbors ¶
func (mock *SynchronizerMock) Neighbors() []neighborhood.Neighbor
Neighbors calls NeighborsFunc.
func (*SynchronizerMock) NeighborsCalls ¶
func (mock *SynchronizerMock) NeighborsCalls() []struct { }
NeighborsCalls gets all the calls that were made to Neighbors. Check the length with:
len(mockedSynchronizer.NeighborsCalls())
type TimeMock ¶
type TimeMock struct { // NowFunc mocks the Now method. NowFunc func() time.Time // contains filtered or unexported fields }
TimeMock is a mock implementation of Time.
func TestSomethingThatUsesTime(t *testing.T) { // make and configure a mocked Time mockedTime := &TimeMock{ NowFunc: func() time.Time { panic("mock out the Now method") }, } // use mockedTime in code that requires Time // and then make assertions. }