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 wrap: on
line diff
--- a/API/Objects/Requirement/RequirementHandlerTests.cs	Sun May 01 15:38:01 2011 +0000
+++ b/API/Objects/Requirement/RequirementHandlerTests.cs	Sun May 01 19:14:38 2011 +0000
@@ -183,6 +183,22 @@
 			RequirementHandler.ValidateArmy(army, out failureMessages);
 			Assert.That(failureMessages, Has.Count(2));
 		}
+
+		[Test()]
+		public void TestAddingToArmyWithMixedRequirementsGetsExpectedFailureMessageCount()
+		{
+			MockRace race = new MockRace();
+			MockUnitType mockUnitType = new MockUnitType();
+			mockUnitType.AddRequirement(new PassingRequirement());
+			mockUnitType.AddRequirement(new NotApplicableRequirement());
+			mockUnitType.AddRequirement(new FailingRequirement());
+			mockUnitType.AddRequirement(new FailingRequirement());
+			race.AddUnitType(mockUnitType);
+			Army army = new Army(race, "test", 1000);
+			ICollection<string> failureMessages;
+			RequirementHandler.AllowsAdding(mockUnitType, army, out failureMessages);
+			Assert.That(failureMessages, Has.Count(2));
+		}
 	}
 }