The use case 4 states
Use Case 4: Estimation saved
Moderator enters a round name (?) .
Participants choose a value.
The value is a card – that have a value. Wikipedia states that
<<Several commercially available decks use the sequence: 0,½,1,2,3,5,8,13,20,40,100,and optionally a ? (unsure) and a coffee cup (I need a break). Some organizations use standard playing cards of Ace,2,3,5,8 and king. Where king means: "this item is too big or too complicated to estimate". "Throwing a king" ends discussion of the item for the current sprint. >>
It is clear that the value ( as stated incorrectly in the use case ) is a Card – and this will be a class that have a value( decimal / double ) and there will be some cards ( unsure,coffee cup,king) that do not have value.
However,the cards must
- be converted from and to the decimal / double value( if possible)
- be added and converted to decimal / double
The code for the tests will be the following and it is self explanatory
[TestMethod]
public void CoffeeCupEqualsCoffeeCup()
{
var c1 = Card.CoffeeCup;
var c2 = Card.CoffeeCup;
Assert.AreEqual(c1,c2);
}
[TestMethod]
public void ConvertValuesEqual()
{
var d = 1.2m;
var c1 = (Card)d;
var c2 = (Card)d;
Assert.AreEqual(c1,c2);
}
[TestMethod]
public void ValuesEqual()
{
var d = 1.2m;
var c1 = new Card(d);
var c2 = new Card(d);
Assert.AreEqual(c1,c2);
}
[TestMethod]
public void AddingValues()
{
var d1 = 1.2m;
var d2 = 1.2m;
var c1 = new Card(d1);
var c2 = new Card(d2);
var c3 = Card.CoffeeCup;
var d = (decimal) (c1 + c2+c3);
Assert.AreEqual(d1+d2,d);
}
The code is much more complicated . I am thinking where and how to share it – I want to have CI and build on Azure.
Leave a Reply