Mercurial > repos > IBBoard.WarFoundry.API.Tests
annotate API/Objects/Requirement/Mock/AbstractFixedRequirement.cs @ 208:c323770e61c2
Re #379: Fix validation of requirements to check for unit
* Rename classes in tests to match API changes
* Alter tests to match new API (all classes require at least one UnitType that they're relevant to now)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 22 Feb 2012 20:48:40 +0000 |
parents | 32b3e41bc8f0 |
children | 5e03b68dd214 |
rev | line source |
---|---|
133 | 1 // This file (AbstractFixedRequirement.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard |
2 // | |
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. | |
4 using System; | |
5 | |
6 namespace IBBoard.WarFoundry.API.Objects.Requirement.Mock | |
7 { | |
179
32b3e41bc8f0
Fixes #338: WarFoundry.API - Save System Data
IBBoard <dev@ibboard.co.uk>
parents:
146
diff
changeset
|
8 public abstract class AbstractFixedRequirement : IRequirement |
133 | 9 { |
10 private Validation result; | |
11 | |
179
32b3e41bc8f0
Fixes #338: WarFoundry.API - Save System Data
IBBoard <dev@ibboard.co.uk>
parents:
146
diff
changeset
|
12 public string RequirementID |
32b3e41bc8f0
Fixes #338: WarFoundry.API - Save System Data
IBBoard <dev@ibboard.co.uk>
parents:
146
diff
changeset
|
13 { |
32b3e41bc8f0
Fixes #338: WarFoundry.API - Save System Data
IBBoard <dev@ibboard.co.uk>
parents:
146
diff
changeset
|
14 get { return GetType().Name; } |
32b3e41bc8f0
Fixes #338: WarFoundry.API - Save System Data
IBBoard <dev@ibboard.co.uk>
parents:
146
diff
changeset
|
15 } |
32b3e41bc8f0
Fixes #338: WarFoundry.API - Save System Data
IBBoard <dev@ibboard.co.uk>
parents:
146
diff
changeset
|
16 |
133 | 17 public AbstractFixedRequirement(Validation fixedResult) |
18 { | |
19 result = fixedResult; | |
20 } | |
21 | |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
179
diff
changeset
|
22 public Validation AllowsAdding(IWarFoundryObject wfObject, Army toArmy) |
133 | 23 { |
24 return result; | |
25 } | |
26 | |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
179
diff
changeset
|
27 public Validation ValidatesArmy(Army army) |
133 | 28 { |
29 return result; | |
30 } | |
141
cd95fc6400b2
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
31 |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
179
diff
changeset
|
32 public string GetValidationMessage(Army army) |
141
cd95fc6400b2
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
33 { |
cd95fc6400b2
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
34 return (result.Equals(Validation.Failed)) ? "Validation failed" : ""; |
cd95fc6400b2
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
35 } |
146
8c519a44e699
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
141
diff
changeset
|
36 |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
179
diff
changeset
|
37 public string GetAllowsAddingMessage(IWarFoundryObject toAdd, Army toArmy) |
146
8c519a44e699
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
141
diff
changeset
|
38 { |
8c519a44e699
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
141
diff
changeset
|
39 return (result.Equals(Validation.Failed)) ? "Validation failed" : ""; |
8c519a44e699
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
141
diff
changeset
|
40 } |
133 | 41 } |
42 } | |
43 |