Mercurial > repos > IBBoard.WarFoundry.API.Tests
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/API/Objects/UnitTypeTest.cs Mon May 17 20:04:13 2010 +0000 @@ -0,0 +1,34 @@ +// This file (UnitTypeTest.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2010 IBBoard +// +// // 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. +using IBBoard.WarFoundry.API.Objects.Mock; +using NUnit.Framework; +using NUnit.Framework.Constraints; +using NUnit.Framework.SyntaxHelpers; + +namespace IBBoard.WarFoundry.API.Objects +{ + [TestFixture()] + public class UnitTypeTest + { + [Test()] + public void TestSettingMainCategorySetsCategoriesCollection() + { + UnitType unitType = new UnitType("unittype1", "Swordsmen", new MockRace()); + MockCategory mockCategory = new MockCategory(); + unitType.MainCategory = mockCategory; + Assert.That(unitType.Categories, Has.Member(mockCategory)); + } + + [Test()] + public void TestAddingFirstCategorySetsMainCategory() + { + UnitType unitType = new UnitType("unittype1", "Swordsmen", new MockRace()); + MockCategory mockCategory = new MockCategory(); + unitType.AddCategory(mockCategory); + Assert.That(unitType.Categories, Has.Member(mockCategory)); + Assert.That(unitType.MainCategory, Is.EqualTo(mockCategory)); + } + } +} +