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 diff
     1.1 --- a/API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirementTest.cs	Sat Apr 09 10:43:01 2011 +0000
     1.2 +++ b/API/Objects/Requirement/RequiresNoMoreThanNOfUnitTypeRequirementTest.cs	Sat Apr 09 10:50:29 2011 +0000
     1.3 @@ -96,6 +96,17 @@
     1.4  			Assert.That(req.AllowsAdding(unitType1, army), Is.EqualTo(Validation.Failed));
     1.5  		}
     1.6  
     1.7 +		[Test]
     1.8 +		public void TestRequirementBecomesInvalidWhenProhibitedUnitsChange()
     1.9 +		{
    1.10 +			Army army = new Army(mockRace, "Test", 1000);
    1.11 +			RequiresNoMoreThanNOfUnitTypeRequirement req = new RequiresNoMoreThanNOfUnitTypeRequirement();
    1.12 +			req.AddUnitTypeRequirement(unitType2);
    1.13 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
    1.14 +			AddUnitOfTypeToArmy(unitType2, army);
    1.15 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
    1.16 +		}
    1.17 +
    1.18  		private static void AddUnitOfTypeToArmy(UnitType unitType, Army army)
    1.19  		{
    1.20  			army.AddUnit(CreateUnitOfType(unitType, army));