using System; using NUnit.Framework; using CandyHouseBase.DataModels; using CandyHouseBase.Enums; using CandyHouseBase.Exceptions; namespace CandyHouseTests.DataModelsTests { [TestFixture] public class SupplyItemDataModelTests { [Test] public void SupplyItem_ShouldThrowException_WhenSupplyIdIsInvalid() { var supplyItem = new SupplyItemDataModel("", Guid.NewGuid().ToString(), 10, ItemType.Ingredient); Assert.Throws(supplyItem.Validate); } [Test] public void SupplyItem_ShouldThrowException_WhenItemIdIsInvalid() { var supplyItem = new SupplyItemDataModel(Guid.NewGuid().ToString(), "", 10, ItemType.Product); Assert.Throws(supplyItem.Validate); } [Test] public void SupplyItem_ShouldThrowException_WhenQuantityIsZeroOrNegative() { var supplyItem = new SupplyItemDataModel(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), 0, ItemType.Product); Assert.Throws(supplyItem.Validate); } [Test] public void SupplyItem_ShouldCreateSuccessfully_WithValidData() { var supplyItem = new SupplyItemDataModel(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), 10, ItemType.Ingredient); Assert.That(supplyItem.Quantity, Is.EqualTo(10)); Assert.That(supplyItem.ItemType, Is.EqualTo(ItemType.Ingredient)); } } }