changeset 119:5f389466e8a8

Re #27: Unit requirements * Add test to make sure that requirement actually revalidates after change
author IBBoard <dev@ibboard.co.uk>
date Wed, 06 Apr 2011 19:44:31 +0000
parents 1fccac6f8f99
children d186d46f0bae
files API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs	Mon Apr 04 19:46:07 2011 +0000
     1.2 +++ b/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs	Wed Apr 06 19:44:31 2011 +0000
     1.3 @@ -173,6 +173,18 @@
     1.4  			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.NotApplicable));
     1.5  		}
     1.6  
     1.7 +		[Test]
     1.8 +		public void TestSatisfyingRequirementChangesResult()
     1.9 +		{
    1.10 +			Army army = new Army(mockRace, "Test", 1000);
    1.11 +			AddUnitOfTypeToArmy(unitType1, army);
    1.12 +			UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    1.13 +			req.AddUnitTypeRequirement(unitType2);
    1.14 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed));
    1.15 +			AddUnitOfTypeToArmy(unitType2, army);
    1.16 +			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
    1.17 +		}
    1.18 +
    1.19  
    1.20  		private static void AddUnitOfTypeToArmy(UnitType unitType, Army army)
    1.21  		{