public void PayMoreThanPriceThenReturnChangeCorrectly(int price, int amount, int expected) { var sut = new ChangeCalculator(); var result = sut.GetChange(price, amount); Assert.Equal(expected, result); }
public void ChangeCalculatorReturnsTwoQuartersAndANickelFor55Cents() { var change = ChangeCalculator.GetChange(0.55d); change.Coins.Count.ShouldBe(3); change.Coins.Count(c => c.MonetaryValue == 0.25).ShouldBe(2); change.Coins.Count(c => c.MonetaryValue == 0.05).ShouldBe(1); }
public void ChangeCalculatorReturnsThreeQuartersAndADimeFor85Cents() { var change = ChangeCalculator.GetChange(0.85d); change.Coins.Count.ShouldBe(4); change.Coins.Count(c => c.MonetaryValue == 0.25).ShouldBe(3); change.Coins.Count(c => c.MonetaryValue == 0.1).ShouldBe(1); }
public void ChangeCalculatorReturnsAQuarterFor25() { var change = ChangeCalculator.GetChange(0.25d); change.Coins.ShouldNotBeEmpty(); change.Value.ShouldBe(0.25d); change.Coins.Count.ShouldBe(1); }
public void ChangeCalculatorReturnsAQuarterANickelAndADimeFor40Cents() { var change = ChangeCalculator.GetChange(0.4d); change.Coins.Count.ShouldBe(3); change.Coins.Count(c => c.MonetaryValue == 0.25).ShouldBe(1); change.Coins.Count(c => c.MonetaryValue == 0.05).ShouldBe(1); change.Coins.Count(c => c.MonetaryValue == 0.1).ShouldBe(1); }
public void ChangeCalculatorReturnsThreeQuartersFor75cents() { var change = ChangeCalculator.GetChange(0.75d); change.Coins.ShouldNotBeEmpty(); change.Value.ShouldBe(0.75d); change.Coins.Count.ShouldBe(3); change.Coins.Count(c => c.MonetaryValue == 0.25).ShouldBe(3); }
public void GetChange_NotNull() { var change = ChangeCalculator.GetChange(0, 0); Assert.IsNotNull(change); }
public void GetChange_Various_CorrectChange(int receivedMoney, int productPrice, int expected) { var change = ChangeCalculator.GetChange(receivedMoney, productPrice); Assert.AreEqual(expected, change); }