Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
comparison API/Objects/UnitTypeTest.cs @ 128:7ca536ccd27a
Re #27:
* Start testing adding requirements to unit types
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 09 Apr 2011 15:59:55 +0000 |
parents | a3bc8174299f |
children | d28c3c1ec1ec |
comparison
equal
deleted
inserted
replaced
127:779ad76c2644 | 128:7ca536ccd27a |
---|---|
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. | 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 using IBBoard.WarFoundry.API.Objects.Mock; | 4 using IBBoard.WarFoundry.API.Objects.Mock; |
5 using NUnit.Framework; | 5 using NUnit.Framework; |
6 using NUnit.Framework.Constraints; | 6 using NUnit.Framework.Constraints; |
7 using NUnit.Framework.SyntaxHelpers; | 7 using NUnit.Framework.SyntaxHelpers; |
8 using IBBoard.WarFoundry.API.Objects.Requirement; | |
8 | 9 |
9 namespace IBBoard.WarFoundry.API.Objects | 10 namespace IBBoard.WarFoundry.API.Objects |
10 { | 11 { |
11 [TestFixture()] | 12 [TestFixture()] |
12 public class UnitTypeTest | 13 public class UnitTypeTest |
42 Assert.That(unitType.Categories.Length, Is.EqualTo(2)); | 43 Assert.That(unitType.Categories.Length, Is.EqualTo(2)); |
43 Assert.That(unitType.Categories, Has.Member(mockCategory)); | 44 Assert.That(unitType.Categories, Has.Member(mockCategory)); |
44 Assert.That(unitType.Categories, Has.Member(mockCategory2)); | 45 Assert.That(unitType.Categories, Has.Member(mockCategory2)); |
45 Assert.That(unitType.MainCategory, Is.EqualTo(mockCategory)); | 46 Assert.That(unitType.MainCategory, Is.EqualTo(mockCategory)); |
46 } | 47 } |
48 | |
49 [Test] | |
50 public void TestAddingRequirementsToUnitType() | |
51 { | |
52 UnitType unitType = new UnitType("unittype1", "Swordsmen", new MockRace()); | |
53 UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType); | |
54 Assert.That(unitType.GetRequirements(), Has.Length(0)); | |
55 unitType.AddRequirement(req); | |
56 Assert.That(unitType.GetRequirements(), Has.Length(1)); | |
57 } | |
47 } | 58 } |
48 } | 59 } |
49 | 60 |