comparison 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
comparison
equal deleted inserted replaced
45:04d7cd276b1d 46:73308371f9d8
1 // This file (UnitTypeTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2010 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 IBBoard.WarFoundry.API.Objects.Mock;
5 using NUnit.Framework;
6 using NUnit.Framework.Constraints;
7 using NUnit.Framework.SyntaxHelpers;
8
9 namespace IBBoard.WarFoundry.API.Objects
10 {
11 [TestFixture()]
12 public class UnitTypeTest
13 {
14 [Test()]
15 public void TestSettingMainCategorySetsCategoriesCollection()
16 {
17 UnitType unitType = new UnitType("unittype1", "Swordsmen", new MockRace());
18 MockCategory mockCategory = new MockCategory();
19 unitType.MainCategory = mockCategory;
20 Assert.That(unitType.Categories, Has.Member(mockCategory));
21 }
22
23 [Test()]
24 public void TestAddingFirstCategorySetsMainCategory()
25 {
26 UnitType unitType = new UnitType("unittype1", "Swordsmen", new MockRace());
27 MockCategory mockCategory = new MockCategory();
28 unitType.AddCategory(mockCategory);
29 Assert.That(unitType.Categories, Has.Member(mockCategory));
30 Assert.That(unitType.MainCategory, Is.EqualTo(mockCategory));
31 }
32 }
33 }
34