Giter Club home page Giter Club logo

tdd-gilded-rose's Introduction

TDD「镶金玫瑰商店」

业务背景

"镶金玫瑰"!这是一家魔兽世界里的小商店。出售的商品也都是高质量的。但不妙的是,随着商品逐渐接近保质期,它们的质量也不断下滑。我们用一个IT系统来更新库存信息。

首先,简单介绍一下我们的系统:

  • 所有商品都有一个SellIn值,这是商品的保质期,最好在这么多天之内卖掉
  • 所有商品都有一个Quality值,代表商品的价值
  • 商品的SellIn值和Quality值,会随着天数的增加而变化,但是会有特例

商品的价格规则说明如下:

  • 商品的价值永远不会小于0,也永远不会超过50
  • 一旦过了保质期,Quality就以双倍的速度下滑
  • 陈年干酪(Aged Brie)是一种特殊的商品,放得越久,价值反而越高
  • 萨弗拉斯(Sulfuras)是一种传奇商品,没有保质期的概念,质量也不会下滑
  • 后台门票(Backstage pass)和陈年干酪(Aged Brie)有相似之处:
    • 越接近演出日,随着SellIn值的增加,商品价值Quality值反而上升
    • 在演出前10天,价值每天上升2点
    • 演出前5天,价值每天上升3点
    • 一旦过了演出日,价值就马上变成0

tdd-gilded-rose's People

Contributors

yuanshenjian avatar

Watchers

 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.