18
|
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 }
|