public void ShouldHaveNoDispensedProductWhenButtonIsPressedWithoutEnoughCoinsInserted() { var dispenser = new StubbedDispenser(); var sut = new VendingMachine(dispenser); sut.SelectProduct(ProductCodes.Cola); Assert.False(dispenser.WasProductDispensed); }
public void ShouldNotDispenseProductWhenInvalidButtonIsEntered() { var dispenser = new StubbedDispenser(); var sut = new VendingMachine(dispenser); sut.SelectProduct("Invalid"); Assert.False(dispenser.WasProductDispensed); }
public void ShouldDispenseProductWhenButtonIsPressedWithEnoughCoinsInserted(string productCode, int numberOfQuartersInserted) { var dispenser = new StubbedDispenser(); var sut = new VendingMachine(dispenser); StockMachineWithCoinsNeededToMakeChange(sut); for (var i = 0; i < numberOfQuartersInserted; i++) { sut.InsertCoin(_testBuilder.CreateQuarter()); } sut.StockProduct(new Dictionary <string, int> { { productCode, 1 } }); sut.SelectProduct(productCode); Assert.True(dispenser.WasProductDispensed); }