Mercurial > repos > IBBoard.WarFoundry.API.Tests
view API/Util/UnitEquipmentUtilTest.cs @ 18:e8e7554fb7f3
Re #198: Add slots with count
* Add initial unit equipment util tests
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 24 Oct 2009 18:59:30 +0000 |
parents | |
children | 9b23e72ba3cf |
line wrap: on
line source
// This file (UnitEquipmentItemUtilTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2009 IBBoard // // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. using System; using NUnit.Framework; using IBBoard.Limits; using IBBoard.WarFoundry.API.Objects; using IBBoard.WarFoundry.API.Objects.Mock; namespace IBBoard.WarFoundry.API.Util { [TestFixture()] public class UnitEquipmentUtilTest { [Test()] public void TestGetMaxEquipmentCountForFixedLimitItemOnDefaultSlot() { UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(); equip.MaxNumber = 3; UnitType unitType = equip.EquipmentForUnit; Unit unit = new MockUnit(unitType, new MockArmyCategory(unitType.MainCategory)); Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip)); } [Test()] public void TestGetMaxEquipmentCountForFixedLimitItemOnNumberLimitedSlot() { UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem(); equip.MaxNumber = 3; UnitType unitType = equip.EquipmentForUnit; unitType.AddEquipmentSlot("slot", new AbsoluteNumericLimit(2)); Unit unit = new MockUnit(unitType, new MockArmyCategory(unitType.MainCategory)); Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip)); } } }