Mercurial > repos > IBBoard.WarFoundry.API.Tests
comparison API/Objects/Requirements/UnitRequiresAtLeastNUnitsRequirementTest.cs @ 105:9163bd04a3db
Re #27: Define unit requirements
* Update method name for a more "natural language" approach of "if (req.AllowsAdding(...))"
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 27 Mar 2011 19:15:22 +0000 |
parents | 782494137b58 |
children | 4dad874f4862 |
comparison
equal
deleted
inserted
replaced
104:782494137b58 | 105:9163bd04a3db |
---|---|
29 public void TestAddingUnitWithNoUnitsAndOneUnitTypeRequired() | 29 public void TestAddingUnitWithNoUnitsAndOneUnitTypeRequired() |
30 { | 30 { |
31 Army army = new Army(mockRace, "Test", 1000); | 31 Army army = new Army(mockRace, "Test", 1000); |
32 Unit unit = CreateUnitOfType(unitType1, army); | 32 Unit unit = CreateUnitOfType(unitType1, army); |
33 UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType2); | 33 UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType2); |
34 Assert.That(req.CanAddToArmy(unit, army), Is.False); | 34 Assert.That(req.AllowsAdding(unit, army), Is.False); |
35 } | 35 } |
36 | 36 |
37 [Test()] | 37 [Test()] |
38 public void TestAddingUnitWithOneUnitAndOneUnitTypeRequired() | 38 public void TestAddingUnitWithOneUnitAndOneUnitTypeRequired() |
39 { | 39 { |
40 Army army = new Army(mockRace, "Test", 1000); | 40 Army army = new Army(mockRace, "Test", 1000); |
41 AddUnitOfTypeToArmy(unitType2, army); | 41 AddUnitOfTypeToArmy(unitType2, army); |
42 Unit unit = CreateUnitOfType(unitType1, army); | 42 Unit unit = CreateUnitOfType(unitType1, army); |
43 UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType2); | 43 UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType2); |
44 Assert.That(req.CanAddToArmy(unit, army), Is.True); | 44 Assert.That(req.AllowsAdding(unit, army), Is.True); |
45 } | 45 } |
46 | 46 |
47 [Test()] | 47 [Test()] |
48 public void TestAddingUnitTypeWithNoUnitsAndOneUnitTypeRequired() | 48 public void TestAddingUnitTypeWithNoUnitsAndOneUnitTypeRequired() |
49 { | 49 { |
50 Army army = new Army(mockRace, "Test", 1000); | 50 Army army = new Army(mockRace, "Test", 1000); |
51 UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType2); | 51 UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType2); |
52 Assert.That(req.CanAddToArmy(unitType1, army), Is.False); | 52 Assert.That(req.AllowsAdding(unitType1, army), Is.False); |
53 } | 53 } |
54 | 54 |
55 [Test()] | 55 [Test()] |
56 public void TestAddingUnitTypeWithOneUnitAndOneUnitTypeRequired() | 56 public void TestAddingUnitTypeWithOneUnitAndOneUnitTypeRequired() |
57 { | 57 { |
58 Army army = new Army(mockRace, "Test", 1000); | 58 Army army = new Army(mockRace, "Test", 1000); |
59 AddUnitOfTypeToArmy(unitType2, army); | 59 AddUnitOfTypeToArmy(unitType2, army); |
60 UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType2); | 60 UnitRequiresAtLeastNUnitsRequirement req = new UnitRequiresAtLeastNUnitsRequirement(unitType2); |
61 Assert.That(req.CanAddToArmy(unitType1, army), Is.True); | 61 Assert.That(req.AllowsAdding(unitType1, army), Is.True); |
62 } | 62 } |
63 | 63 |
64 private static void AddUnitOfTypeToArmy(UnitType unitType, Army army) | 64 private static void AddUnitOfTypeToArmy(UnitType unitType, Army army) |
65 { | 65 { |
66 army.AddUnit(CreateUnitOfType(unitType, army)); | 66 army.AddUnit(CreateUnitOfType(unitType, army)); |