Mercurial > repos > IBBoard.WarFoundry.API.Tests
annotate API/Objects/Requirement/Mock/AbstractFixedRequirement.cs @ 176:9a1763af5fd2
Re #338: WarFoundry.API - Save System Data
* Add tests for saving point names
* Add expected values for new tests
* Add points names to existing expected values (because we don't know if they were default or not)
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 26 Oct 2011 15:40:52 +0100 |
parents | 8c519a44e699 |
children | 32b3e41bc8f0 |
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 { | |
8 public class AbstractFixedRequirement : IRequirement | |
9 { | |
10 private Validation result; | |
11 | |
12 public AbstractFixedRequirement(Validation fixedResult) | |
13 { | |
14 result = fixedResult; | |
15 } | |
16 | |
17 public Validation AllowsAdding (WarFoundryObject wfObject, Army toArmy) | |
18 { | |
19 return result; | |
20 } | |
21 | |
22 public Validation ValidatesArmy (Army army) | |
23 { | |
24 return result; | |
25 } | |
141
cd95fc6400b2
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
26 |
cd95fc6400b2
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
27 public string GetValidationMessage (Army army) |
cd95fc6400b2
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
28 { |
cd95fc6400b2
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
29 return (result.Equals(Validation.Failed)) ? "Validation failed" : ""; |
cd95fc6400b2
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
133
diff
changeset
|
30 } |
146
8c519a44e699
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
141
diff
changeset
|
31 |
8c519a44e699
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
141
diff
changeset
|
32 public string GetAllowsAddingMessage (UnitType toAdd, Army toArmy) |
8c519a44e699
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
141
diff
changeset
|
33 { |
8c519a44e699
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
141
diff
changeset
|
34 return (result.Equals(Validation.Failed)) ? "Validation failed" : ""; |
8c519a44e699
Re #345: Add failure message to requirements
IBBoard <dev@ibboard.co.uk>
parents:
141
diff
changeset
|
35 } |
133 | 36 } |
37 } | |
38 |