Giter VIP home page Giter VIP logo

shopping-basket-kata's Introduction

Shopping Cart Kata

Scenario 1 - Add items to shopping basket

Given I add 2 units of "The Hobbit" to my shopping basket And I add 5 units of "Breaking Bad" When I check the content of my shopping basket Then it should contain the following infomation:

  • Creation date (of the shopping basket)
  • 2 x The Hobbit // 2 x 5.00 = £10.00
  • 5 x Breaking Bad // 5 x 7.00 = £35.00
  • Total: £45.00

Acceptance criteria:

  • Shopping basket should be created when the first product is added.
  • Shopping basket should be persisted (In-memory, DB later)
  • Each user should have her own shopping basket.

Products available (in-memory repository):

  • Books
    • 10001: Lord of the Rings - £10.00
    • 10002: The Hobbit - £5.00
  • DVDs
    • 20001: Game of Thrones - £9.00
    • 20110: Breaking Bad - £7.00
    public class ShoppingBasketService {
    
        public void addItem(UserID userId, ProductID productId, int quantity) { }

        public <?> basketFor(UserID userId) { }
    
    }    

Scenario 2 - Logging

  • Log items added to shopping cart on the console:
    • [BASKET CREATED]: Created[<"YYYY-07-12">], User[]
    • [ITEM ADDED TO SHOPPING CART]: Added[<"YYYY-07-12">], User[], Product[ID], Quantity[, Price[<£12.00>]

shopping-basket-kata's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.