public int PointsFor(AmountOfItems <int> dices) { var equality = IntEqualityByLiteral.Build(); int amountOfThrees = dices.AmountOf(3, equality); return(3 * amountOfThrees); }
public int PointsFor(AmountOfItems <int> dices) { var equality = IntEqualityByLiteral.Build(); int amountOfFours = dices.AmountOf(4, equality); return(4 * amountOfFours); }
public int PointsFor(AmountOfItems <int> dices) { int sumSoFar = 0; var equality = IntEqualityByLiteral.Build(); for (int face = 1; face < 7; face++) { sumSoFar += dices.AmountOf(face, equality) * face; } return(sumSoFar); }
public void AmountOf_BeforeAddReturns0_Test() { //Arrange List <int> list = new List <int>(); AmountOfItems <int> amountOfItems = ListBackedAmountOfItems <int> .Build(list); var equalityOperation = IntEqualityByLiteral.Build(); int expected = 0; //Act int actual = amountOfItems.AmountOf(4, equalityOperation); //Assert Assert.AreEqual(expected, actual); }
public void AmountOf_IncreasesByOneWhenAddingOne_Test() { //Arrange int literalToAdd = 0; List <int> list = new List <int>(); AmountOfItems <int> amountOfItems = ListBackedAmountOfItems <int> .Build(list); var equalityOperation = IntEqualityByLiteral.Build(); int expected = 1; amountOfItems.AddOne(literalToAdd); //Act int after = amountOfItems.AmountOf(literalToAdd, equalityOperation); //Assert Assert.AreEqual(expected, after); }