mocks

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlashcardServiceMock

type FlashcardServiceMock struct {
	// DeleteAllCardsInDeckFunc mocks the DeleteAllCardsInDeck method.
	DeleteAllCardsInDeckFunc func(deck value.Deck) error

	// DeleteCardFunc mocks the DeleteCard method.
	DeleteCardFunc func(card value.Card) error

	// DeleteDeckFunc mocks the DeleteDeck method.
	DeleteDeckFunc func(deck value.Deck) error

	// DeleteDeckByNameFunc mocks the DeleteDeckByName method.
	DeleteDeckByNameFunc func(name string) error

	// FilterCardsFunc mocks the FilterCards method.
	FilterCardsFunc func(filterFunc func(value.Card) bool) ([]value.Card, error)

	// FilterCardsInDeckFunc mocks the FilterCardsInDeck method.
	FilterCardsInDeckFunc func(filterFunc func(value.Card) bool, deck value.Deck) ([]value.Card, error)

	// FilterDecksFunc mocks the FilterDecks method.
	FilterDecksFunc func(filterFunc func(value.Deck) bool) ([]value.Deck, error)

	// FindCardsFunc mocks the FindCards method.
	FindCardsFunc func(front string, back string) ([]value.Card, error)

	// FindCardsByFrontFunc mocks the FindCardsByFront method.
	FindCardsByFrontFunc func(front string) ([]value.Card, error)

	// FindCardsByFrontInDeckFunc mocks the FindCardsByFrontInDeck method.
	FindCardsByFrontInDeckFunc func(front string, deck value.Deck) ([]value.Card, error)

	// FindCardsInDeckFunc mocks the FindCardsInDeck method.
	FindCardsInDeckFunc func(front string, back string, inDeck value.Deck) ([]value.Card, error)

	// FindDeckByNameFunc mocks the FindDeckByName method.
	FindDeckByNameFunc func(name string) (*value.Deck, error)

	// ListAllCardsFunc mocks the ListAllCards method.
	ListAllCardsFunc func(inDeck value.Deck) ([]value.Card, error)

	// ListAllDecksFunc mocks the ListAllDecks method.
	ListAllDecksFunc func() ([]value.Deck, error)

	// PutCardInDeckFunc mocks the PutCardInDeck method.
	PutCardInDeckFunc func(card value.Card, deck value.Deck) (*value.Card, error)

	// SaveCardFunc mocks the SaveCard method.
	SaveCardFunc func(card value.Card) (*value.Card, error)

	// SaveDeckFunc mocks the SaveDeck method.
	SaveDeckFunc func(deck value.Deck) (*value.Deck, error)
	// contains filtered or unexported fields
}

FlashcardServiceMock is a mock implementation of service.FlashcardService.

func TestSomethingThatUsesFlashcardService(t *testing.T) {

	// make and configure a mocked service.FlashcardService
	mockedFlashcardService := &FlashcardServiceMock{
		DeleteAllCardsInDeckFunc: func(deck value.Deck) error {
			panic("mock out the DeleteAllCardsInDeck method")
		},
		DeleteCardFunc: func(card value.Card) error {
			panic("mock out the DeleteCard method")
		},
		DeleteDeckFunc: func(deck value.Deck) error {
			panic("mock out the DeleteDeck method")
		},
		DeleteDeckByNameFunc: func(name string) error {
			panic("mock out the DeleteDeckByName method")
		},
		FilterCardsFunc: func(filterFunc func(value.Card) bool) ([]value.Card, error) {
			panic("mock out the FilterCards method")
		},
		FilterCardsInDeckFunc: func(filterFunc func(value.Card) bool, deck value.Deck) ([]value.Card, error) {
			panic("mock out the FilterCardsInDeck method")
		},
		FilterDecksFunc: func(filterFunc func(value.Deck) bool) ([]value.Deck, error) {
			panic("mock out the FilterDecks method")
		},
		FindCardsFunc: func(front string, back string) ([]value.Card, error) {
			panic("mock out the FindCards method")
		},
		FindCardsByFrontFunc: func(front string) ([]value.Card, error) {
			panic("mock out the FindCardsByFront method")
		},
		FindCardsByFrontInDeckFunc: func(front string, deck value.Deck) ([]value.Card, error) {
			panic("mock out the FindCardsByFrontInDeck method")
		},
		FindCardsInDeckFunc: func(front string, back string, inDeck value.Deck) ([]value.Card, error) {
			panic("mock out the FindCardsInDeck method")
		},
		FindDeckByNameFunc: func(name string) (*value.Deck, error) {
			panic("mock out the FindDeckByName method")
		},
		ListAllCardsFunc: func(inDeck value.Deck) ([]value.Card, error) {
			panic("mock out the ListAllCards method")
		},
		ListAllDecksFunc: func() ([]value.Deck, error) {
			panic("mock out the ListAllDecks method")
		},
		PutCardInDeckFunc: func(card value.Card, deck value.Deck) (*value.Card, error) {
			panic("mock out the PutCardInDeck method")
		},
		SaveCardFunc: func(card value.Card) (*value.Card, error) {
			panic("mock out the SaveCard method")
		},
		SaveDeckFunc: func(deck value.Deck) (*value.Deck, error) {
			panic("mock out the SaveDeck method")
		},
	}

	// use mockedFlashcardService in code that requires service.FlashcardService
	// and then make assertions.

}

func (*FlashcardServiceMock) DeleteAllCardsInDeck added in v0.2.0

func (mock *FlashcardServiceMock) DeleteAllCardsInDeck(deck value.Deck) error

DeleteAllCardsInDeck calls DeleteAllCardsInDeckFunc.

func (*FlashcardServiceMock) DeleteAllCardsInDeckCalls added in v0.2.0

func (mock *FlashcardServiceMock) DeleteAllCardsInDeckCalls() []struct {
	Deck value.Deck
}

DeleteAllCardsInDeckCalls gets all the calls that were made to DeleteAllCardsInDeck. Check the length with:

len(mockedFlashcardService.DeleteAllCardsInDeckCalls())

func (*FlashcardServiceMock) DeleteCard added in v0.2.0

func (mock *FlashcardServiceMock) DeleteCard(card value.Card) error

DeleteCard calls DeleteCardFunc.

func (*FlashcardServiceMock) DeleteCardCalls added in v0.2.0

func (mock *FlashcardServiceMock) DeleteCardCalls() []struct {
	Card value.Card
}

DeleteCardCalls gets all the calls that were made to DeleteCard. Check the length with:

len(mockedFlashcardService.DeleteCardCalls())

func (*FlashcardServiceMock) DeleteDeck added in v0.4.0

func (mock *FlashcardServiceMock) DeleteDeck(deck value.Deck) error

DeleteDeck calls DeleteDeckFunc.

func (*FlashcardServiceMock) DeleteDeckByName

func (mock *FlashcardServiceMock) DeleteDeckByName(name string) error

DeleteDeckByName calls DeleteDeckByNameFunc.

func (*FlashcardServiceMock) DeleteDeckByNameCalls

func (mock *FlashcardServiceMock) DeleteDeckByNameCalls() []struct {
	Name string
}

DeleteDeckByNameCalls gets all the calls that were made to DeleteDeckByName. Check the length with:

len(mockedFlashcardService.DeleteDeckByNameCalls())

func (*FlashcardServiceMock) DeleteDeckCalls added in v0.4.0

func (mock *FlashcardServiceMock) DeleteDeckCalls() []struct {
	Deck value.Deck
}

DeleteDeckCalls gets all the calls that were made to DeleteDeck. Check the length with:

len(mockedFlashcardService.DeleteDeckCalls())

func (*FlashcardServiceMock) FilterCards added in v0.2.0

func (mock *FlashcardServiceMock) FilterCards(filterFunc func(value.Card) bool) ([]value.Card, error)

FilterCards calls FilterCardsFunc.

func (*FlashcardServiceMock) FilterCardsCalls added in v0.2.0

func (mock *FlashcardServiceMock) FilterCardsCalls() []struct {
	FilterFunc func(value.Card) bool
}

FilterCardsCalls gets all the calls that were made to FilterCards. Check the length with:

len(mockedFlashcardService.FilterCardsCalls())

func (*FlashcardServiceMock) FilterCardsInDeck added in v0.2.1

func (mock *FlashcardServiceMock) FilterCardsInDeck(filterFunc func(value.Card) bool, deck value.Deck) ([]value.Card, error)

FilterCardsInDeck calls FilterCardsInDeckFunc.

func (*FlashcardServiceMock) FilterCardsInDeckCalls added in v0.2.1

func (mock *FlashcardServiceMock) FilterCardsInDeckCalls() []struct {
	FilterFunc func(value.Card) bool
	Deck       value.Deck
}

FilterCardsInDeckCalls gets all the calls that were made to FilterCardsInDeck. Check the length with:

len(mockedFlashcardService.FilterCardsInDeckCalls())

func (*FlashcardServiceMock) FilterDecks added in v0.2.0

func (mock *FlashcardServiceMock) FilterDecks(filterFunc func(value.Deck) bool) ([]value.Deck, error)

FilterDecks calls FilterDecksFunc.

func (*FlashcardServiceMock) FilterDecksCalls added in v0.2.0

func (mock *FlashcardServiceMock) FilterDecksCalls() []struct {
	FilterFunc func(value.Deck) bool
}

FilterDecksCalls gets all the calls that were made to FilterDecks. Check the length with:

len(mockedFlashcardService.FilterDecksCalls())

func (*FlashcardServiceMock) FindCards added in v0.2.1

func (mock *FlashcardServiceMock) FindCards(front string, back string) ([]value.Card, error)

FindCards calls FindCardsFunc.

func (*FlashcardServiceMock) FindCardsByFront added in v0.4.0

func (mock *FlashcardServiceMock) FindCardsByFront(front string) ([]value.Card, error)

FindCardsByFront calls FindCardsByFrontFunc.

func (*FlashcardServiceMock) FindCardsByFrontCalls added in v0.4.0

func (mock *FlashcardServiceMock) FindCardsByFrontCalls() []struct {
	Front string
}

FindCardsByFrontCalls gets all the calls that were made to FindCardsByFront. Check the length with:

len(mockedFlashcardService.FindCardsByFrontCalls())

func (*FlashcardServiceMock) FindCardsByFrontInDeck added in v0.4.0

func (mock *FlashcardServiceMock) FindCardsByFrontInDeck(front string, deck value.Deck) ([]value.Card, error)

FindCardsByFrontInDeck calls FindCardsByFrontInDeckFunc.

func (*FlashcardServiceMock) FindCardsByFrontInDeckCalls added in v0.4.0

func (mock *FlashcardServiceMock) FindCardsByFrontInDeckCalls() []struct {
	Front string
	Deck  value.Deck
}

FindCardsByFrontInDeckCalls gets all the calls that were made to FindCardsByFrontInDeck. Check the length with:

len(mockedFlashcardService.FindCardsByFrontInDeckCalls())

func (*FlashcardServiceMock) FindCardsCalls added in v0.2.1

func (mock *FlashcardServiceMock) FindCardsCalls() []struct {
	Front string
	Back  string
}

FindCardsCalls gets all the calls that were made to FindCards. Check the length with:

len(mockedFlashcardService.FindCardsCalls())

func (*FlashcardServiceMock) FindCardsInDeck added in v0.2.1

func (mock *FlashcardServiceMock) FindCardsInDeck(front string, back string, inDeck value.Deck) ([]value.Card, error)

FindCardsInDeck calls FindCardsInDeckFunc.

func (*FlashcardServiceMock) FindCardsInDeckCalls added in v0.2.1

func (mock *FlashcardServiceMock) FindCardsInDeckCalls() []struct {
	Front  string
	Back   string
	InDeck value.Deck
}

FindCardsInDeckCalls gets all the calls that were made to FindCardsInDeck. Check the length with:

len(mockedFlashcardService.FindCardsInDeckCalls())

func (*FlashcardServiceMock) FindDeckByName

func (mock *FlashcardServiceMock) FindDeckByName(name string) (*value.Deck, error)

FindDeckByName calls FindDeckByNameFunc.

func (*FlashcardServiceMock) FindDeckByNameCalls

func (mock *FlashcardServiceMock) FindDeckByNameCalls() []struct {
	Name string
}

FindDeckByNameCalls gets all the calls that were made to FindDeckByName. Check the length with:

len(mockedFlashcardService.FindDeckByNameCalls())

func (*FlashcardServiceMock) ListAllCards

func (mock *FlashcardServiceMock) ListAllCards(inDeck value.Deck) ([]value.Card, error)

ListAllCards calls ListAllCardsFunc.

func (*FlashcardServiceMock) ListAllCardsCalls

func (mock *FlashcardServiceMock) ListAllCardsCalls() []struct {
	InDeck value.Deck
}

ListAllCardsCalls gets all the calls that were made to ListAllCards. Check the length with:

len(mockedFlashcardService.ListAllCardsCalls())

func (*FlashcardServiceMock) ListAllDecks

func (mock *FlashcardServiceMock) ListAllDecks() ([]value.Deck, error)

ListAllDecks calls ListAllDecksFunc.

func (*FlashcardServiceMock) ListAllDecksCalls

func (mock *FlashcardServiceMock) ListAllDecksCalls() []struct {
}

ListAllDecksCalls gets all the calls that were made to ListAllDecks. Check the length with:

len(mockedFlashcardService.ListAllDecksCalls())

func (*FlashcardServiceMock) PutCardInDeck added in v0.2.0

func (mock *FlashcardServiceMock) PutCardInDeck(card value.Card, deck value.Deck) (*value.Card, error)

PutCardInDeck calls PutCardInDeckFunc.

func (*FlashcardServiceMock) PutCardInDeckCalls added in v0.2.0

func (mock *FlashcardServiceMock) PutCardInDeckCalls() []struct {
	Card value.Card
	Deck value.Deck
}

PutCardInDeckCalls gets all the calls that were made to PutCardInDeck. Check the length with:

len(mockedFlashcardService.PutCardInDeckCalls())

func (*FlashcardServiceMock) SaveCard

func (mock *FlashcardServiceMock) SaveCard(card value.Card) (*value.Card, error)

SaveCard calls SaveCardFunc.

func (*FlashcardServiceMock) SaveCardCalls

func (mock *FlashcardServiceMock) SaveCardCalls() []struct {
	Card value.Card
}

SaveCardCalls gets all the calls that were made to SaveCard. Check the length with:

len(mockedFlashcardService.SaveCardCalls())

func (*FlashcardServiceMock) SaveDeck

func (mock *FlashcardServiceMock) SaveDeck(deck value.Deck) (*value.Deck, error)

SaveDeck calls SaveDeckFunc.

func (*FlashcardServiceMock) SaveDeckCalls

func (mock *FlashcardServiceMock) SaveDeckCalls() []struct {
	Deck value.Deck
}

SaveDeckCalls gets all the calls that were made to SaveDeck. Check the length with:

len(mockedFlashcardService.SaveDeckCalls())

Jump to

Keyboard shortcuts

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