Mercurial > repos > IBBoard.WarFoundry.API.Tests
changeset 207:27f163bf884a
Re #379: Fix validation of requirements to check for unit
* Update checked text to match new, cleaner text
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 31 Jan 2012 20:59:15 +0000 |
parents | 78ba834cb1f7 |
children | c323770e61c2 |
files | API/Objects/Requirement/RequiresNUnitsForMUnitsRequirementTest.cs API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs API/Objects/Requirement/UnitRequiresNoMoreThanNOfUnitTypeRequirementTest.cs |
diffstat | 3 files changed, 50 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/API/Objects/Requirement/RequiresNUnitsForMUnitsRequirementTest.cs Sun Jan 29 20:03:44 2012 +0000 +++ b/API/Objects/Requirement/RequiresNUnitsForMUnitsRequirementTest.cs Tue Jan 31 20:59:15 2012 +0000 @@ -62,7 +62,7 @@ RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 "+unitType2.Name+" for every 1 "+unitType1.Name + " (would have 0 for 1).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1).")); } [Test()] @@ -75,7 +75,7 @@ req.AddUnitTypeRequirement(unitType3); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (would have 0 for 1).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 0 for 1).")); } [Test()] @@ -87,7 +87,7 @@ RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 1 " + unitType1.Name + " (would have 1 for 2).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2).")); } [Test()] @@ -115,7 +115,7 @@ req.AddUnitTypeRequirement(unitType3, 1, 1); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (would have 1 for 2).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2).")); } [Test()] @@ -130,7 +130,7 @@ req.AddUnitTypeRequirement(unitType3, 1, 1); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 1 " + unitType1.Name + " (would have 1 for 2); 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (would have 1 for 2).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2).")); } [Test()] @@ -143,7 +143,7 @@ RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2, unitType3); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 1 " + unitType1.Name + " (would have 1 for 2); 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (would have 1 for 2).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 1 for 2).")); } [Test()] @@ -157,7 +157,7 @@ req.AddUnitTypeRequirement(unitType2, 1, 2); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 2 " + unitType1.Name + " (would have 1 for 3).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (would have 1 for 3).")); } [Test()] @@ -169,7 +169,7 @@ req.AddUnitTypeRequirement(unitType2, 2, 3); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 " + unitType2.Name + " for every 3 " + unitType1.Name + " (would have 1 for 1).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (would have 1 for 1).")); } [Test()] @@ -182,7 +182,7 @@ req.AddUnitTypeRequirement(unitType2, 2, 3); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 " + unitType2.Name + " for every 3 " + unitType1.Name + " (would have 1 for 2).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (would have 1 for 2).")); } [Test()] @@ -195,7 +195,7 @@ req.AddUnitTypeRequirement(unitType2, 2, 3); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 " + unitType2.Name + " for every 3 " + unitType1.Name + " (would have 3 for 4).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (would have 3 for 4).")); } [Test()] @@ -287,7 +287,7 @@ req.AddUnitTypeRequirement(unitType2, unitType3); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 1 " + unitType1.Name + " (would have 2 for 3).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 2 for 3).")); } [Test()] @@ -302,7 +302,7 @@ req.AddUnitTypeRequirement(unitType2, unitType3); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 1 " + unitType1.Name + " (would have 2 for 3).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 2 for 3).")); } [Test()] @@ -317,7 +317,7 @@ req.AddUnitTypeRequirement(unitType2, unitType3); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 1 " + unitType1.Name + " (would have 2 for 3).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 1 × " + unitType1.Name + " (would have 2 for 3).")); } [Test()] @@ -408,7 +408,7 @@ req.AddUnitTypeRequirement(3, unitType2, unitType3); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 3 " + unitType1.Name + " (would have 2 for 7).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (would have 2 for 7).")); } [Test()] @@ -421,7 +421,7 @@ req.AddUnitTypeRequirement(3, unitType2, unitType3); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 3 " + unitType1.Name + " (would have 2 for 7).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (would have 2 for 7).")); } [Test()] @@ -434,7 +434,7 @@ req.AddUnitTypeRequirement(3, unitType2, unitType3); Unit unit = CreateUnitOfType(unitType1, army); Assert.That(req.AllowsAdding(unit, army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 3 " + unitType1.Name + " (would have 2 for 7).")); + Assert.That(req.GetAllowsAddingMessage(unit.UnitType, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (would have 2 for 7).")); } [Test()] @@ -464,7 +464,7 @@ AddUnitOfTypeToArmy(unitType1, army); RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2); Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 1 " + unitType1.Name + " (have 0 for 1).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1).")); } [Test()] @@ -477,7 +477,7 @@ req.AddUnitTypeRequirement(unitType2); req.AddUnitTypeRequirement(unitType3); Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (have 0 for 1).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 0 for 1).")); } [Test()] @@ -489,7 +489,7 @@ AddUnitOfTypeToArmy(unitType1, army); RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2); Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 1 " + unitType1.Name + " (have 1 for 2).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2).")); } [Test()] @@ -517,7 +517,7 @@ req.AddUnitTypeRequirement(unitType2, 1, 2); req.AddUnitTypeRequirement(unitType3, 1, 1); Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (have 1 for 2).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2).")); } [Test()] @@ -532,7 +532,7 @@ req.AddUnitTypeRequirement(unitType2, 1, 1); req.AddUnitTypeRequirement(unitType3, 1, 1); Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 1 " + unitType1.Name + " (have 1 for 2); 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (have 1 for 2).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2).")); } [Test()] @@ -545,7 +545,7 @@ AddUnitOfTypeToArmy(unitType1, army); RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1, unitType2, unitType3); Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 1 " + unitType1.Name + " (have 1 for 2); 1 " + unitType3.Name + " for every 1 " + unitType1.Name + " (have 1 for 2).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2); 1 × " + unitType3.Name + " for every 1 × " + unitType1.Name + " (have 1 for 2).")); } [Test()] @@ -557,7 +557,7 @@ RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); req.AddUnitTypeRequirement(unitType2, 2, 3); Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 " + unitType2.Name + " for every 3 " + unitType1.Name + " (have 1 for 1).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (have 1 for 1).")); } [Test()] @@ -569,7 +569,7 @@ RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); req.AddUnitTypeRequirement(unitType2, 2, 3); Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 " + unitType2.Name + " for every 3 " + unitType1.Name + " (have 1 for 2).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (have 1 for 2).")); } [Test()] @@ -581,7 +581,7 @@ RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); req.AddUnitTypeRequirement(unitType2, 2, 3); Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 " + unitType2.Name + " for every 3 " + unitType1.Name + " (have 3 for 4).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " for every 3 × " + unitType1.Name + " (have 3 for 4).")); } [Test()] @@ -595,7 +595,7 @@ RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); req.AddUnitTypeRequirement(unitType2, 1, 2); Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " for every 2 " + unitType1.Name + " (have 1 for 3).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " for every 2 × " + unitType1.Name + " (have 1 for 3).")); } [Test()] @@ -680,7 +680,7 @@ RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); req.AddUnitTypeRequirement(3, unitType2, unitType3); Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 3 " + unitType1.Name + " (have 2 for 7).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (have 2 for 7).")); } [Test()] @@ -692,7 +692,7 @@ RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); req.AddUnitTypeRequirement(3, unitType2, unitType3); Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 3 " + unitType1.Name + " (have 2 for 7).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (have 2 for 7).")); } [Test()] @@ -704,7 +704,7 @@ RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType1); req.AddUnitTypeRequirement(3, unitType2, unitType3); Assert.That(req.ValidatesArmy(army), Is.EqualTo(Validation.Failed)); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 " + unitType2.Name + " or " + unitType3.Name + " for every 3 " + unitType1.Name + " (have 2 for 7).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " or " + unitType3.Name + " for every 3 × " + unitType1.Name + " (have 2 for 7).")); } private static void AddUnitsOfTypeToArmy(int count, UnitType unitType, Army army) @@ -725,21 +725,21 @@ return new Unit(unitType, army.GetCategory(unitType.MainCategory)); } - public override RequiresNUnitsForMUnitsRequirement GetObject() + public override RequiresNUnitsForMUnitsRequirement GetObject() { RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType3); req.AddUnitTypeRequirement(unitType1, 2, 3); return req; } - public override RequiresNUnitsForMUnitsRequirement GetSameObject() + public override RequiresNUnitsForMUnitsRequirement GetSameObject() { RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType3); req.AddUnitTypeRequirement(unitType1, 2, 3); return req; } - public override RequiresNUnitsForMUnitsRequirement GetDifferentObject() + public override RequiresNUnitsForMUnitsRequirement GetDifferentObject() { RequiresNUnitsForMUnitsRequirement req = new RequiresNUnitsForMUnitsRequirement(unitType3); DummyWarFoundryFactory factory = new DummyWarFoundryFactory();
--- a/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs Sun Jan 29 20:03:44 2012 +0000 +++ b/API/Objects/Requirement/UnitRequiresAtLeastNUnitsRequirementTest.cs Tue Jan 31 20:59:15 2012 +0000 @@ -238,7 +238,7 @@ AddUnitOfTypeToArmy(unitType1, army); RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1); req.AddUnitTypeRequirement(unitType2); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army contains " + unitType1.Name + " and so must contain: 1 × " + unitType2.Name + " (have 0).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (have 0).")); } [Test] @@ -248,7 +248,7 @@ AddUnitOfTypeToArmy(unitType1, army); RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1); req.AddUnitTypeRequirement(unitType2, 2); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army contains " + unitType1.Name + " and so must contain: 2 × " + unitType2.Name + " (have 0).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " (have 0).")); } [Test] @@ -259,7 +259,7 @@ RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1); req.AddUnitTypeRequirement(unitType2); req.AddUnitTypeRequirement(unitType3); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army contains " + unitType1.Name + " and so must contain: 1 × " + unitType2.Name + " (have 0); 1 × " + unitType3.Name + " (have 0).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (have 0); 1 × " + unitType3.Name + " (have 0).")); } [Test] @@ -277,7 +277,7 @@ Army army = new Army(mockRace, "Test", 1000); RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1); req.AddUnitTypeRequirement(unitType2, 2); - Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army would contain " + unitType1.Name + " and so must contain: 2 × " + unitType2.Name + " (would have 1).")); + Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army must contain: 2 × " + unitType2.Name + " (would have 1).")); } [Test] @@ -287,7 +287,7 @@ RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1); req.AddUnitTypeRequirement(unitType2); req.AddUnitTypeRequirement(unitType3); - Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army would contain " + unitType1.Name + " and so must contain: 1 × " + unitType3.Name + " (would have 0).")); + Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " (would have 0).")); } [Test] @@ -297,7 +297,7 @@ RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1); req.AddUnitTypeRequirement(unitType2); req.AddUnitTypeRequirement(unitType3); - Assert.That(req.GetAllowsAddingMessage(unitType3, army), Is.EqualTo("Army would contain " + unitType1.Name + " and so must contain: 1 × " + unitType2.Name + " (would have 0).")); + Assert.That(req.GetAllowsAddingMessage(unitType3, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (would have 0).")); } [Test] @@ -308,7 +308,7 @@ RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1); req.AddUnitTypeRequirement(unitType2); req.AddUnitTypeRequirement(unitType3); - Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army would contain " + unitType1.Name + " and so must contain: 1 × " + unitType3.Name + " (would have 0).")); + Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army must contain: 1 × " + unitType3.Name + " (would have 0).")); } [Test] @@ -319,7 +319,7 @@ RequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType1); req.AddUnitTypeRequirement(unitType2); req.AddUnitTypeRequirement(unitType3); - Assert.That(req.GetAllowsAddingMessage(unitType3, army), Is.EqualTo("Army would contain " + unitType1.Name + " and so must contain: 1 × " + unitType2.Name + " (would have 0).")); + Assert.That(req.GetAllowsAddingMessage(unitType3, army), Is.EqualTo("Army must contain: 1 × " + unitType2.Name + " (would have 0).")); } private static void AddUnitOfTypeToArmy(UnitType unitType, Army army)
--- a/API/Objects/Requirement/UnitRequiresNoMoreThanNOfUnitTypeRequirementTest.cs Sun Jan 29 20:03:44 2012 +0000 +++ b/API/Objects/Requirement/UnitRequiresNoMoreThanNOfUnitTypeRequirementTest.cs Tue Jan 31 20:59:15 2012 +0000 @@ -161,7 +161,7 @@ AddUnitOfTypeToArmy(unitType2, army); RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1); req.AddUnitTypeRequirement(unitType2); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army contains " + unitType1.Name + " and so cannot contain more than: 0 × " + unitType2.Name + " (have 1).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (have 1).")); } [Test] @@ -174,7 +174,7 @@ AddUnitOfTypeToArmy(unitType2, army); RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1); req.AddUnitTypeRequirement(unitType2, 2); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army contains " + unitType1.Name + " and so cannot contain more than: 2 × " + unitType2.Name + " (have 3).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 2 × " + unitType2.Name + " (have 3).")); } [Test] @@ -186,7 +186,7 @@ RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1); req.AddUnitTypeRequirement(unitType2); req.AddUnitTypeRequirement(unitType3); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army contains " + unitType1.Name + " and so cannot contain more than: 0 × " + unitType2.Name + " (have 1).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (have 1).")); } [Test] @@ -198,7 +198,7 @@ RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1); req.AddUnitTypeRequirement(unitType2); req.AddUnitTypeRequirement(unitType3); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army contains " + unitType1.Name + " and so cannot contain more than: 0 × " + unitType3.Name + " (have 1).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType3.Name + " (have 1).")); } [Test] @@ -211,7 +211,7 @@ RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1); req.AddUnitTypeRequirement(unitType2); req.AddUnitTypeRequirement(unitType3); - Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army contains " + unitType1.Name + " and so cannot contain more than: 0 × " + unitType2.Name + " (have 1); 0 × " + unitType3.Name + " (have 1).")); + Assert.That(req.GetValidationMessage(army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (have 1); 0 × " + unitType3.Name + " (have 1).")); } [Test] @@ -230,7 +230,7 @@ AddUnitOfTypeToArmy(unitType1, army); RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1); req.AddUnitTypeRequirement(unitType2); - Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army would contain " + unitType1.Name + " and so cannot contain more than: 0 × " + unitType2.Name + " (would have 1).")); + Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (would have 1).")); } [Test] @@ -242,7 +242,7 @@ AddUnitOfTypeToArmy(unitType2, army); RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1); req.AddUnitTypeRequirement(unitType2, 2); - Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army would contain " + unitType1.Name + " and so cannot contain more than: 2 × " + unitType2.Name + " (would have 3).")); + Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army cannot contain more than: 2 × " + unitType2.Name + " (would have 3).")); } [Test] @@ -253,7 +253,7 @@ RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1); req.AddUnitTypeRequirement(unitType2); req.AddUnitTypeRequirement(unitType3); - Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army would contain " + unitType1.Name + " and so cannot contain more than: 0 × " + unitType2.Name + " (would have 1).")); + Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (would have 1).")); } [Test] @@ -265,7 +265,7 @@ RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1); req.AddUnitTypeRequirement(unitType2); req.AddUnitTypeRequirement(unitType3); - Assert.That(req.GetAllowsAddingMessage(unitType3, army), Is.EqualTo("Army would contain " + unitType1.Name + " and so cannot contain more than: 0 × " + unitType2.Name + " (would have 1); 0 × " + unitType3.Name + " (would have 1).")); + Assert.That(req.GetAllowsAddingMessage(unitType3, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (would have 1); 0 × " + unitType3.Name + " (would have 1).")); } [Test] @@ -277,7 +277,7 @@ RequiresNoMoreThanNOfUnitTypeRequirement req = new UnitRequiresNoMoreThanNOfUnitTypeRequirement(unitType1); req.AddUnitTypeRequirement(unitType2); req.AddUnitTypeRequirement(unitType3); - Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army would contain " + unitType1.Name + " and so cannot contain more than: 0 × " + unitType2.Name + " (would have 1); 0 × " + unitType3.Name + " (would have 1).")); + Assert.That(req.GetAllowsAddingMessage(unitType2, army), Is.EqualTo("Army cannot contain more than: 0 × " + unitType2.Name + " (would have 1); 0 × " + unitType3.Name + " (would have 1).")); } private static void AddUnitOfTypeToArmy(UnitType unitType, Army army)