Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
changeset 143:6fdb76d48e04
Re #345: Add failure message to requirements
* Test return of messages from requirement handler
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 01 May 2011 14:45:22 +0000 |
parents | f36b5e5e51e6 |
children | eced294e82f2 |
files | API/Objects/Requirement/RequirementHandlerTests.cs |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/API/Objects/Requirement/RequirementHandlerTests.cs Sun May 01 14:32:24 2011 +0000 +++ b/API/Objects/Requirement/RequirementHandlerTests.cs Sun May 01 14:45:22 2011 +0000 @@ -7,6 +7,7 @@ using IBBoard.WarFoundry.API.Objects; using NUnit.Framework.SyntaxHelpers; using IBBoard.WarFoundry.API.Objects.Requirement.Mock; +using System.Collections.Generic; namespace IBBoard.WarFoundry.API.Objects.Requirement { @@ -166,6 +167,22 @@ Army army = new Army(race, "test", 1000); Assert.That(RequirementHandler.AllowsAdding(mockUnitType, army), Is.EqualTo(Validation.Passed)); } + + [Test()] + public void TestArmyWithMixedRequirementsGetsExpectedFailureMessageCount() + { + 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.ValidateArmy(army, out failureMessages); + Assert.That(failureMessages, Has.Count(2)); + } } }