Mercurial > repos > IBBoard.WarFoundry.API.Tests
changeset 123:dd0ef8526a4e
Re #27: Unit Requirements
* Test base "no more than" requirement validates armies correctly
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 09 Apr 2011 10:50:29 +0000 |
parents | aa37b31976e6 |
children | 14a007cf2446 |
files | API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirementTest.cs |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirementTest.cs Sat Apr 09 10:43:01 2011 +0000 +++ b/API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirementTest.cs Sat Apr 09 10:50:29 2011 +0000 @@ -96,6 +96,17 @@ Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed)); } + [Test] + public void TestRequirementBecomesInvalidWhenProhibitedUnitsChange() + { + Army army = new Army(mockRace, "Test", 1000); + RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement(); + req.AddUnitTypeRequirement(unitType2); + Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed)); + AddUnitOfTypeToArmy(unitType2, army); + Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); + } + private static void AddUnitOfTypeToArmy(UnitType unitType, Army army) { army.AddUnit(CreateUnitOfType(unitType, army));