Mercurial > repos > IBBoard.WarFoundry.API.Tests
changeset 136:d28c3c1ec1ec
Re #27: Unit requirements
* Make sure that units return their limits as requirements on the army
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 25 Apr 2011 15:09:54 +0000 |
parents | 8c3bba80a25e |
children | 081b48413f6d |
files | API/Objects/UnitTypeTest.cs |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/API/Objects/UnitTypeTest.cs Mon Apr 25 10:31:49 2011 +0000 +++ b/API/Objects/UnitTypeTest.cs Mon Apr 25 15:09:54 2011 +0000 @@ -55,6 +55,21 @@ unitType.AddRequirement(req); Assert.That(unitType.GetRequirements(), Has.Length(1)); } + + [Test] + public void TestGetRequirementsGetsUnitCountRequirements() + { + UnitType unitType = new UnitType("unittype1", "Swordsmen", new MockRace()); + unitType.MinNumber = 1; + unitType.MaxNumber = 2; + Assert.That(unitType.GetRequirements(), Has.Length(2)); + RequiresNoMoreThanNOfUnitTypeRequirement maxLimit = new RequiresNoMoreThanNOfUnitTypeRequirement(); + maxLimit.AddUnitTypeRequirement(unitType, 2); + Assert.That(unitType.GetRequirements(), Has.Member(maxLimit)); + RequiresAtLeastNUnitsRequirement minLimit = new RequiresAtLeastNUnitsRequirement(); + minLimit.AddUnitTypeRequirement(unitType, 1); + Assert.That(unitType.GetRequirements(), Has.Member(minLimit)); + } } }