Mercurial > repos > IBBoard.WarFoundry.API.Tests
annotate API/Objects/Requirement/Mock/AbstractFixedRequirement.cs @ 237:833f72be715a default tip
* Remove rogue print statements
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 06 Nov 2012 20:58:48 +0000 |
parents | be409428bbea |
children |
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; | |
231
5e03b68dd214
Re #410: Create "N units per M models in parent unit" requirement
IBBoard <dev@ibboard.co.uk>
parents:
208
diff
changeset
|
5 using IBBoard.WarFoundry.API.Objects.Requirement.Context; |
133 | 6 |
7 namespace IBBoard.WarFoundry.API.Objects.Requirement.Mock | |
8 { | |
179
32b3e41bc8f0
Fixes #338: WarFoundry.API - Save System Data
IBBoard <dev@ibboard.co.uk>
parents:
146
diff
changeset
|
9 public abstract class AbstractFixedRequirement : IRequirement |
133 | 10 { |
11 private Validation result; | |
12 | |
179
32b3e41bc8f0
Fixes #338: WarFoundry.API - Save System Data
IBBoard <dev@ibboard.co.uk>
parents:
146
diff
changeset
|
13 public string RequirementID |
32b3e41bc8f0
Fixes #338: WarFoundry.API - Save System Data
IBBoard <dev@ibboard.co.uk>
parents:
146
diff
changeset
|
14 { |
32b3e41bc8f0
Fixes #338: WarFoundry.API - Save System Data
IBBoard <dev@ibboard.co.uk>
parents:
146
diff
changeset
|
15 get { return GetType().Name; } |
32b3e41bc8f0
Fixes #338: WarFoundry.API - Save System Data
IBBoard <dev@ibboard.co.uk>
parents:
146
diff
changeset
|
16 } |
32b3e41bc8f0
Fixes #338: WarFoundry.API - Save System Data
IBBoard <dev@ibboard.co.uk>
parents:
146
diff
changeset
|
17 |
133 | 18 public AbstractFixedRequirement(Validation fixedResult) |
19 { | |
20 result = fixedResult; | |
21 } | |
22 | |
236
be409428bbea
Re #410: Create "N units per M models in parent unit" requirement
IBBoard <dev@ibboard.co.uk>
parents:
231
diff
changeset
|
23 public Validation AllowsAdding(IWarFoundryObject wfObject, Army toArmy, AddingContext context) |
133 | 24 { |
25 return result; | |
26 } | |
27 | |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
179
diff
changeset
|
28 public Validation ValidatesArmy(Army army) |
133 | 29 { |
30 return result; | |
31 } | |
141
cd95fc6400b2
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
32 |
208
c323770e61c2
Re #379: Fix validation of requirements to check for unit
IBBoard <dev@ibboard.co.uk>
parents:
179
diff
changeset
|
33 public string GetValidationMessage(Army army) |
141
cd95fc6400b2
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
34 { |
cd95fc6400b2
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
35 return (result.Equals(Validation.Failed)) ? "Validation failed" : ""; |
cd95fc6400b2
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
36 } |
146
8c519a44e699
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
141
diff
changeset
|
37 |
231
5e03b68dd214
Re #410: Create "N units per M models in parent unit" requirement
IBBoard <dev@ibboard.co.uk>
parents:
208
diff
changeset
|
38 public string GetAllowsAddingMessage(IWarFoundryObject toAdd, Army toArmy, AddingContext context) |
146
8c519a44e699
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
141
diff
changeset
|
39 { |
8c519a44e699
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
141
diff
changeset
|
40 return (result.Equals(Validation.Failed)) ? "Validation failed" : ""; |
8c519a44e699
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
141
diff
changeset
|
41 } |
133 | 42 } |
43 } | |
44 |