Mercurial > repos > IBBoard.WarFoundry.API.Tests
comparison API/Objects/Requirement/RequirementHandlerTests.cs @ 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 | 8c3bba80a25e |
children | 0d40d80226b8 |
comparison
equal
deleted
inserted
replaced
142:f36b5e5e51e6 | 143:6fdb76d48e04 |
---|---|
5 using NUnit.Framework; | 5 using NUnit.Framework; |
6 using IBBoard.WarFoundry.API.Objects.Mock; | 6 using IBBoard.WarFoundry.API.Objects.Mock; |
7 using IBBoard.WarFoundry.API.Objects; | 7 using IBBoard.WarFoundry.API.Objects; |
8 using NUnit.Framework.SyntaxHelpers; | 8 using NUnit.Framework.SyntaxHelpers; |
9 using IBBoard.WarFoundry.API.Objects.Requirement.Mock; | 9 using IBBoard.WarFoundry.API.Objects.Requirement.Mock; |
10 using System.Collections.Generic; | |
10 | 11 |
11 namespace IBBoard.WarFoundry.API.Objects.Requirement | 12 namespace IBBoard.WarFoundry.API.Objects.Requirement |
12 { | 13 { |
13 [TestFixture()] | 14 [TestFixture()] |
14 public class RequirementHandlerTests | 15 public class RequirementHandlerTests |
164 mockUnitType.AddRequirement(new NotApplicableRequirement()); | 165 mockUnitType.AddRequirement(new NotApplicableRequirement()); |
165 race.AddUnitType(mockUnitType); | 166 race.AddUnitType(mockUnitType); |
166 Army army = new Army(race, "test", 1000); | 167 Army army = new Army(race, "test", 1000); |
167 Assert.That(RequirementHandler.AllowsAdding(mockUnitType, army), Is.EqualTo(Validation.Passed)); | 168 Assert.That(RequirementHandler.AllowsAdding(mockUnitType, army), Is.EqualTo(Validation.Passed)); |
168 } | 169 } |
170 | |
171 [Test()] | |
172 public void TestArmyWithMixedRequirementsGetsExpectedFailureMessageCount() | |
173 { | |
174 MockRace race = new MockRace(); | |
175 MockUnitType mockUnitType = new MockUnitType(); | |
176 mockUnitType.AddRequirement(new PassingRequirement()); | |
177 mockUnitType.AddRequirement(new NotApplicableRequirement()); | |
178 mockUnitType.AddRequirement(new FailingRequirement()); | |
179 mockUnitType.AddRequirement(new FailingRequirement()); | |
180 race.AddUnitType(mockUnitType); | |
181 Army army = new Army(race, "test", 1000); | |
182 ICollection<string> failureMessages; | |
183 RequirementHandler.ValidateArmy(army, out failureMessages); | |
184 Assert.That(failureMessages, Has.Count(2)); | |
185 } | |
169 } | 186 } |
170 } | 187 } |
171 | 188 |