Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
diff API/Objects/Requirement/RequiresAtLeastNUnitsRequirementTest.cs @ 124:14a007cf2446
Re #27: Unit requirements
* Add test for adding required unit types to satisfy requirements
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 09 Apr 2011 10:56:30 +0000 |
parents | 49fb69ea13f2 |
children | 7fa4d5215afe |
line wrap: on
line diff
--- a/API/Objects/Requirement/RequiresAtLeastNUnitsRequirementTest.cs Sat Apr 09 10:50:29 2011 +0000 +++ b/API/Objects/Requirement/RequiresAtLeastNUnitsRequirementTest.cs Sat Apr 09 10:56:30 2011 +0000 @@ -139,6 +139,17 @@ Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed)); } + [Test] + public void TestAddingMinNumberUnitTypePassesRequirement() + { + Army army = new Army(mockRace, "Test", 1000); + RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(); + req.AddUnitTypeRequirement(unitType2, 2); + Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Failed)); + AddUnitOfTypeToArmy(unitType2, army); + Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Passed)); + } + private static void AddUnitOfTypeToArmy(UnitType unitType, Army army) { army.AddUnit(CreateUnitOfType(unitType, army));