Versions in this module Expand all Collapse all v0 v0.4.1 Jun 12, 2020 Changes in this version + func AssertNoError(t *testing.T, err error) v0.3.1 Jun 11, 2020 Changes in this version + var ErrUnknownCart = errors.New("unknown cart") + func AssertCartProduct(t *testing.T, cart *Cart, product Product) + func AssertCartProductLines(t *testing.T, cart *Cart, qty int) + func AssertCartProductQty(t *testing.T, cart *Cart, product Product, qty Quantity) + func AssertEquals(t *testing.T, got int, want int) + type Cart struct + BuyerID UUID + ID UUID + Products Products + func NewCart(id, buyerId UUID) *Cart + func NewCartsFromJSON(rdr io.Reader) ([]Cart, error) + func (c *Cart) AddProduct(product Product) + func (c *Cart) GetProducts() Products + type CartRepository interface + Get func(id string) (*Cart, error) + Save func(cart *Cart) error + type FileSystemCartRepository struct + func (f *FileSystemCartRepository) Get(id string) (*Cart, error) + func (f *FileSystemCartRepository) Save(cart *Cart) error + type Price float32 type Product + ID string + Price Price + Units Quantity + func NewProduct(ID, Name string, Price Price, Units Quantity) Product + func (p Product) Equal(other Product) bool + type Quantity int type StubCartStore + Carts []Cart + func (s *StubCartStore) Get(id string) (*Cart, error) + func (s *StubCartStore) Save(cart *Cart) error + type UUID string v0.2.1 Jun 10, 2020 Changes in this version + func AssertProduct(t *testing.T, store *StubCartStore, product Product) + type CartServer struct + func NewCartServer(store CartStore) *CartServer + type CartStore interface + AddProduct func(product Product) + GetProducts func() Products + type FileSystemCartStore struct + func FileSystemCartStoreFromFile(path string) (*FileSystemCartStore, func(), error) + func NewFileSystemCartStore(file *os.File) (*FileSystemCartStore, error) + func (f *FileSystemCartStore) AddProduct(product Product) + func (f *FileSystemCartStore) GetProducts() Products + type Product struct + Name string + Qty int + func NewProducts(rdr io.Reader) ([]Product, error) + type Products []Product + func (p Products) Find(name string) *Product + type StubCartStore struct + Products []Product + func (s *StubCartStore) AddProduct(product Product) + func (s *StubCartStore) GetProducts() Products