annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 // This file (UnitEquipmentItemUtilTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2009 IBBoard
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
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.
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System;
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 using NUnit.Framework;
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 using IBBoard.Limits;
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 using IBBoard.WarFoundry.API.Objects;
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 using IBBoard.WarFoundry.API.Objects.Mock;
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 namespace IBBoard.WarFoundry.API.Util
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 {
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 [TestFixture()]
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 public class UnitEquipmentUtilTest
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 {
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 [Test()]
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 public void TestGetMaxEquipmentCountForFixedLimitItemOnDefaultSlot()
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 {
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem();
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 equip.MaxNumber = 3;
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 UnitType unitType = equip.EquipmentForUnit;
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 Unit unit = new MockUnit(unitType, new MockArmyCategory(unitType.MainCategory));
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 Assert.AreEqual(3, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 }
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 [Test()]
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 public void TestGetMaxEquipmentCountForFixedLimitItemOnNumberLimitedSlot()
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 {
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29 UnitEquipmentItem equip = new MockNumericAmountUnitEquipmentItem();
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 equip.MaxNumber = 3;
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 UnitType unitType = equip.EquipmentForUnit;
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32 unitType.AddEquipmentSlot("slot", new AbsoluteNumericLimit(2));
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 Unit unit = new MockUnit(unitType, new MockArmyCategory(unitType.MainCategory));
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34 Assert.AreEqual(2, UnitEquipmentUtil.GetMaxEquipmentCount(unit, equip));
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35 }
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 }
e8e7554fb7f3 Re #198: Add slots with count
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 }