comparison 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
comparison
equal deleted inserted replaced
17:4480d7151d35 18:e8e7554fb7f3
1 // This file (UnitEquipmentItemUtilTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2009 IBBoard
2 //
3 // 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.
4
5 using System;
6 using NUnit.Framework;
7 using IBBoard.Limits;
8 using IBBoard.WarFoundry.API.Objects;
9 using IBBoard.WarFoundry.API.Objects.Mock;
10
11 namespace IBBoard.WarFoundry.API.Util
12 {
13 [TestFixture()]
14 public class UnitEquipmentUtilTest
15 {
16 [Test()]
17 public void TestGetMaxEquipmentCountForFixedLimitItemOnDefaultSlot()
18 {
19 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem();
20 equip.MaxNumber = 3;
21 UnitType unitType = equip.EquipmentForUnit;
22 Unit unit = new MockUnit(unitType, new MockArmyCategory(unitType.MainCategory));
23 Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
24 }
25
26 [Test()]
27 public void TestGetMaxEquipmentCountForFixedLimitItemOnNumberLimitedSlot()
28 {
29 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem();
30 equip.MaxNumber = 3;
31 UnitType unitType = equip.EquipmentForUnit;
32 unitType.AddEquipmentSlot("slot", new AbsoluteNumericLimit(2));
33 Unit unit = new MockUnit(unitType, new MockArmyCategory(unitType.MainCategory));
34 Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
35 }
36 }
37 }