Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
comparison API/Objects/Requirement/RequiresAtLeastNUnitsRequirementTest.cs @ 108:74bfe8b325d6
Re #27: Define unit requirements
* Add tests where a min count > 1 is set
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 27 Mar 2011 19:49:51 +0000 |
parents | e2ea6562ef08 |
children | f5f66483032a |
comparison
equal
deleted
inserted
replaced
107:e2ea6562ef08 | 108:74bfe8b325d6 |
---|---|
90 RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2, unitType3); | 90 RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2, unitType3); |
91 Assert.That(req.AllowsAdding(unitType1, army), Is.True); | 91 Assert.That(req.AllowsAdding(unitType1, army), Is.True); |
92 } | 92 } |
93 | 93 |
94 [Test()] | 94 [Test()] |
95 public void TestAddingUnitTypeWithOneUnitsAndTwoOfOneUnitTypeRequired() | 95 public void TestAddingUnitTypeWithOneUnitAndTwoOfOneUnitTypeRequired() |
96 { | 96 { |
97 Army army = new Army(mockRace, "Test", 1000); | 97 Army army = new Army(mockRace, "Test", 1000); |
98 AddUnitOfTypeToArmy(unitType2, army); | 98 AddUnitOfTypeToArmy(unitType2, army); |
99 RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(); | 99 RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(); |
100 req.AddUnitTypeRequirement(unitType2, 2); | 100 req.AddUnitTypeRequirement(unitType2, 2); |
101 Assert.That(req.AllowsAdding(unitType1, army), Is.False); | 101 Assert.That(req.AllowsAdding(unitType1, army), Is.False); |
102 } | 102 } |
103 | 103 |
104 [Test()] | 104 [Test()] |
105 public void TestAddingUnitTypeWithOneUnitAndOneUnitTypeRequired() | 105 public void TestAddingUnitTypeWithTwoUnitAndTwoOfOneUnitTypeRequired() |
106 { | 106 { |
107 Army army = new Army(mockRace, "Test", 1000); | 107 Army army = new Army(mockRace, "Test", 1000); |
108 AddUnitOfTypeToArmy(unitType2, army); | 108 AddUnitOfTypeToArmy(unitType2, army); |
109 RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(unitType2); | 109 AddUnitOfTypeToArmy(unitType2, army); |
110 RequiresAtLeastNUnitsRequirement req = new RequiresAtLeastNUnitsRequirement(); | |
111 req.AddUnitTypeRequirement(unitType2, 2); | |
110 Assert.That(req.AllowsAdding(unitType1, army), Is.True); | 112 Assert.That(req.AllowsAdding(unitType1, army), Is.True); |
111 } | 113 } |
112 | 114 |
113 private static void AddUnitOfTypeToArmy(UnitType unitType, Army army) | 115 private static void AddUnitOfTypeToArmy(UnitType unitType, Army army) |
114 { | 116 { |