using System; using NUnit.Framework; using CandyHouseBase.DataModels; using CandyHouseBase.Exceptions; namespace CandyHouseTests.DataModelsTests { [TestFixture] public class IngredientStockDataModelTests { [Test] public void IngredientStock_ShouldThrowException_WhenIdIsInvalid() { var stock = new IngredientStockDataModel("", 10); Assert.Throws(stock.Validate); } [Test] public void IngredientStock_ShouldThrowException_WhenQuantityIsNegative() { var stock = new IngredientStockDataModel(Guid.NewGuid().ToString(), -5); Assert.Throws(stock.Validate); } [Test] public void IngredientStock_ShouldAddStockCorrectly() { var stock = new IngredientStockDataModel(Guid.NewGuid().ToString(), 10); stock.AddStock(5); Assert.That(stock.Quantity, Is.EqualTo(15)); } [Test] public void IngredientStock_ShouldThrowException_WhenRemovingTooMuchStock() { var stock = new IngredientStockDataModel(Guid.NewGuid().ToString(), 10); Assert.Throws(() => stock.RemoveStock(15)); } } }