cachemock

package
v0.0.0-...-95b083d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2023 License: Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicMock

type BasicMock struct {
	// ExsFunc mocks the Exs method.
	ExsFunc func(key string) bool

	// GetFunc mocks the Get method.
	GetFunc func(key string) interface{}

	// SetFunc mocks the Set method.
	SetFunc func(key string, value interface{})

	// SetEXFunc mocks the SetEX method.
	SetEXFunc func(key string, value interface{}) (interface{}, bool)
	// contains filtered or unexported fields
}

BasicMock is a mock implementation of cache.Basic.

func TestSomethingThatUsesBasic(t *testing.T) {

	// make and configure a mocked cache.Basic
	mockedBasic := &BasicMock{
		ExsFunc: func(key string) bool {
			panic("mock out the Exs method")
		},
		GetFunc: func(key string) interface{} {
			panic("mock out the Get method")
		},
		SetFunc: func(key string, value interface{})  {
			panic("mock out the Set method")
		},
		SetEXFunc: func(key string, value interface{}) (interface{}, bool) {
			panic("mock out the SetEX method")
		},
	}

	// use mockedBasic in code that requires cache.Basic
	// and then make assertions.

}

func (*BasicMock) Exs

func (mock *BasicMock) Exs(key string) bool

Exs calls ExsFunc.

func (*BasicMock) ExsCalls

func (mock *BasicMock) ExsCalls() []struct {
	Key string
}

ExsCalls gets all the calls that were made to Exs. Check the length with:

len(mockedBasic.ExsCalls())

func (*BasicMock) Get

func (mock *BasicMock) Get(key string) interface{}

Get calls GetFunc.

func (*BasicMock) GetCalls

func (mock *BasicMock) GetCalls() []struct {
	Key string
}

GetCalls gets all the calls that were made to Get. Check the length with:

len(mockedBasic.GetCalls())

func (*BasicMock) Set

func (mock *BasicMock) Set(key string, value interface{})

Set calls SetFunc.

func (*BasicMock) SetCalls

func (mock *BasicMock) SetCalls() []struct {
	Key   string
	Value interface{}
}

SetCalls gets all the calls that were made to Set. Check the length with:

len(mockedBasic.SetCalls())

func (*BasicMock) SetEX

func (mock *BasicMock) SetEX(key string, value interface{}) (interface{}, bool)

SetEX calls SetEXFunc.

func (*BasicMock) SetEXCalls

func (mock *BasicMock) SetEXCalls() []struct {
	Key   string
	Value interface{}
}

SetEXCalls gets all the calls that were made to SetEX. Check the length with:

len(mockedBasic.SetEXCalls())

type ExchangeMock

type ExchangeMock struct {
	// GetFunc mocks the Get method.
	GetFunc func(symbol string) (*exchange.Symbol, error)

	// SetFunc mocks the Set method.
	SetFunc func(symbols []*exchange.Symbol)

	// SymbolsFunc mocks the Symbols method.
	SymbolsFunc func() []string
	// contains filtered or unexported fields
}

ExchangeMock is a mock implementation of cache.Exchange.

func TestSomethingThatUsesExchange(t *testing.T) {

	// make and configure a mocked cache.Exchange
	mockedExchange := &ExchangeMock{
		GetFunc: func(symbol string) (*exchange.Symbol, error) {
			panic("mock out the Get method")
		},
		SetFunc: func(symbols []*exchange.Symbol)  {
			panic("mock out the Set method")
		},
		SymbolsFunc: func() []string {
			panic("mock out the Symbols method")
		},
	}

	// use mockedExchange in code that requires cache.Exchange
	// and then make assertions.

}

func (*ExchangeMock) Get

func (mock *ExchangeMock) Get(symbol string) (*exchange.Symbol, error)

Get calls GetFunc.

func (*ExchangeMock) GetCalls

func (mock *ExchangeMock) GetCalls() []struct {
	Symbol string
}

GetCalls gets all the calls that were made to Get. Check the length with:

len(mockedExchange.GetCalls())

func (*ExchangeMock) Set

func (mock *ExchangeMock) Set(symbols []*exchange.Symbol)

Set calls SetFunc.

func (*ExchangeMock) SetCalls

func (mock *ExchangeMock) SetCalls() []struct {
	Symbols []*exchange.Symbol
}

SetCalls gets all the calls that were made to Set. Check the length with:

len(mockedExchange.SetCalls())

func (*ExchangeMock) Symbols

func (mock *ExchangeMock) Symbols() []string

Symbols calls SymbolsFunc.

func (*ExchangeMock) SymbolsCalls

func (mock *ExchangeMock) SymbolsCalls() []struct {
}

SymbolsCalls gets all the calls that were made to Symbols. Check the length with:

len(mockedExchange.SymbolsCalls())

type MarketMock

type MarketMock struct {
	// CandleSummaryFunc mocks the CandleSummary method.
	CandleSummaryFunc func(symbol string) (*market.CandleSummary, error)

	// CreateSummaryFunc mocks the CreateSummary method.
	CreateSummaryFunc func(symbol string) *market.CandleSummary

	// UpdateSummaryFunc mocks the UpdateSummary method.
	UpdateSummaryFunc func(symbol string) *market.CandleSummary
	// contains filtered or unexported fields
}

MarketMock is a mock implementation of cache.Market.

func TestSomethingThatUsesMarket(t *testing.T) {

	// make and configure a mocked cache.Market
	mockedMarket := &MarketMock{
		CandleSummaryFunc: func(symbol string) (*market.CandleSummary, error) {
			panic("mock out the CandleSummary method")
		},
		CreateSummaryFunc: func(symbol string) *market.CandleSummary {
			panic("mock out the CreateSummary method")
		},
		UpdateSummaryFunc: func(symbol string) *market.CandleSummary {
			panic("mock out the UpdateSummary method")
		},
	}

	// use mockedMarket in code that requires cache.Market
	// and then make assertions.

}

func (*MarketMock) CandleSummary

func (mock *MarketMock) CandleSummary(symbol string) (*market.CandleSummary, error)

CandleSummary calls CandleSummaryFunc.

func (*MarketMock) CandleSummaryCalls

func (mock *MarketMock) CandleSummaryCalls() []struct {
	Symbol string
}

CandleSummaryCalls gets all the calls that were made to CandleSummary. Check the length with:

len(mockedMarket.CandleSummaryCalls())

func (*MarketMock) CreateSummary

func (mock *MarketMock) CreateSummary(symbol string) *market.CandleSummary

CreateSummary calls CreateSummaryFunc.

func (*MarketMock) CreateSummaryCalls

func (mock *MarketMock) CreateSummaryCalls() []struct {
	Symbol string
}

CreateSummaryCalls gets all the calls that were made to CreateSummary. Check the length with:

len(mockedMarket.CreateSummaryCalls())

func (*MarketMock) UpdateSummary

func (mock *MarketMock) UpdateSummary(symbol string) *market.CandleSummary

UpdateSummary calls UpdateSummaryFunc.

func (*MarketMock) UpdateSummaryCalls

func (mock *MarketMock) UpdateSummaryCalls() []struct {
	Symbol string
}

UpdateSummaryCalls gets all the calls that were made to UpdateSummary. Check the length with:

len(mockedMarket.UpdateSummaryCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL