changeset 125:c9fee4fdc9e8

Re #27: Unit requirements * Add matching test for unit type requiring at least N units
author IBBoard <dev@ibboard.co.uk>
date Sat, 09 Apr 2011 10:58:26 +0000
parents 14a007cf2446
children 6571b6483d2d
files API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs	Sat Apr 09 10:56:30 2011 +0000
     1.2 +++ b/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs	Sat Apr 09 10:58:26 2011 +0000
     1.3 @@ -185,6 +185,18 @@
     1.4  			Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Passed));
     1.5  		}
     1.6  
     1.7 +		[Test]
     1.8 +		public void TestAddingMinNumberUnitTypePassesRequirement()
     1.9 +		{
    1.10 +			Army army = new Army(mockRace, "Test", 1000);
    1.11 +			AddUnitOfTypeToArmy(unitType1, army);
    1.12 +			RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1);
    1.13 +			req.AddUnitTypeRequirement(unitType2, 2);
    1.14 +			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Failed));
    1.15 +			AddUnitOfTypeToArmy(unitType2, army);
    1.16 +			Assert.That(req.AllowsAdding(unitType2, army), Is.EqualTo(Validation.Passed));
    1.17 +		}
    1.18 +
    1.19  
    1.20  		private static void AddUnitOfTypeToArmy(UnitType unitType, Army army)
    1.21  		{