public void Restock_BadStuff_ThrowsException() { // Arrange IVMLogic vml = new VMLogic(); // Act & Assert Assert.Throws <ArgumentException>(() => vml.Restock(0, new Cookie())); Assert.Throws <ArgumentException>(() => vml.Restock(vml.GetAvailableProducts().Length + 1, new Cookie())); Assert.Throws <ArgumentException>(() => vml.Restock(1, null)); }
public void Purchase_SufficientMoney_ReturnsTheProduct() { // Arrange IVMLogic vml = new VMLogic(); // Act int bignumber = 999; while (bignumber-- > 0) { vml.InsertMoney(vml.GetAcceptableMoneyDenominators()[0]); //Add tons of acceptable money to the system } ProductInfo pinfo = vml.GetAvailableProducts()[0]; IProduct result = vml.Purchase(1); // Assert Assert.Equal(pinfo.Id, result.Examine().Id); }