changeset 145:0d40d80226b8

Re #33: Add centralised requirement checker * Add test for getting "allows adding" failure messages from handler
author IBBoard <dev@ibboard.co.uk>
date Sun, 01 May 2011 19:14:38 +0000
parents eced294e82f2
children 8c519a44e699
files API/Objects/Requirement/RequirementHandlerTests.cs
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/API/Objects/Requirement/RequirementHandlerTests.cs	Sun May 01 15:38:01 2011 +0000
     1.2 +++ b/API/Objects/Requirement/RequirementHandlerTests.cs	Sun May 01 19:14:38 2011 +0000
     1.3 @@ -183,6 +183,22 @@
     1.4  			RequirementHandler.ValidateArmy(army, out failureMessages);
     1.5  			Assert.That(failureMessages, Has.Count(2));
     1.6  		}
     1.7 +
     1.8 +		[Test()]
     1.9 +		public void TestAddingToArmyWithMixedRequirementsGetsExpectedFailureMessageCount()
    1.10 +		{
    1.11 +			MockRace race = new MockRace();
    1.12 +			MockUnitType mockUnitType = new MockUnitType();
    1.13 +			mockUnitType.AddRequirement(new PassingRequirement());
    1.14 +			mockUnitType.AddRequirement(new NotApplicableRequirement());
    1.15 +			mockUnitType.AddRequirement(new FailingRequirement());
    1.16 +			mockUnitType.AddRequirement(new FailingRequirement());
    1.17 +			race.AddUnitType(mockUnitType);
    1.18 +			Army army = new Army(race, "test", 1000);
    1.19 +			ICollection<string> failureMessages;
    1.20 +			RequirementHandler.AllowsAdding(mockUnitType, army, out failureMessages);
    1.21 +			Assert.That(failureMessages, Has.Count(2));
    1.22 +		}
    1.23  	}
    1.24  }
    1.25