Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
annotate API/Objects/UnitTypeTest.cs @ 46:73308371f9d8
Re #270: Add multiple categories to API
* Add tests for new property and default behaviour
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 17 May 2010 20:04:13 +0000 |
parents | |
children | 24a40c49b6ae |
rev | line source |
---|---|
46
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 // This file (UnitTypeTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2010 IBBoard |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 // |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
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. |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 using IBBoard.WarFoundry.API.Objects.Mock; |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 using NUnit.Framework; |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 using NUnit.Framework.Constraints; |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 using NUnit.Framework.SyntaxHelpers; |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 namespace IBBoard.WarFoundry.API.Objects |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
10 { |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 [TestFixture()] |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 public class UnitTypeTest |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 { |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 [Test()] |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 public void TestSettingMainCategorySetsCategoriesCollection() |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
16 { |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
17 UnitType unitType = new UnitType("unittype1", "Swordsmen", new MockRace()); |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
18 MockCategory mockCategory = new MockCategory(); |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
19 unitType.MainCategory = mockCategory; |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
20 Assert.That(unitType.Categories, Has.Member(mockCategory)); |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
21 } |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
22 |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
23 [Test()] |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
24 public void TestAddingFirstCategorySetsMainCategory() |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
25 { |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
26 UnitType unitType = new UnitType("unittype1", "Swordsmen", new MockRace()); |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
27 MockCategory mockCategory = new MockCategory(); |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
28 unitType.AddCategory(mockCategory); |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
29 Assert.That(unitType.Categories, Has.Member(mockCategory)); |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
30 Assert.That(unitType.MainCategory, Is.EqualTo(mockCategory)); |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
31 } |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
32 } |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
33 } |
73308371f9d8
Re #270: Add multiple categories to API
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
34 |