annotate API/Objects/UnitEquipmentItemTest.cs @ 148:3561878cdb66

Re #346: Add requirement schema support * Fixed extended race test data for new schema * Tests now work - MonoDevelop just wasn't copying updated schema
author IBBoard <dev@ibboard.co.uk>
date Wed, 01 Jun 2011 20:07:03 +0000
parents 2395dc131401
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 // This file (UnitEquipmentItemTests.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2009 IBBoard
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
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.
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System;
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 using NUnit.Framework;
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 13
diff changeset
7 using IBBoard.Limits;
12
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 using IBBoard.WarFoundry.API.Objects.Mock;
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 namespace IBBoard.WarFoundry.API.Objects
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 {
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 [TestFixture()]
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 public class UnitEquipmentItemTest
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 {
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 [Test()]
28
2395dc131401 * Update unit tests to match change to default min/max limits of equipment items
IBBoard <dev@ibboard.co.uk>
parents: 20
diff changeset
16 public void DefaultMinMaxNumberLimitsAre100Percent()
12
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 {
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 UnitEquipmentItem item = new UnitEquipmentItem(new MockEquipmentItem(), new MockUnitType());
28
2395dc131401 * Update unit tests to match change to default min/max limits of equipment items
IBBoard <dev@ibboard.co.uk>
parents: 20
diff changeset
19 Assert.IsTrue(item.MinLimit is IPercentageLimit);
2395dc131401 * Update unit tests to match change to default min/max limits of equipment items
IBBoard <dev@ibboard.co.uk>
parents: 20
diff changeset
20 Assert.AreEqual(100, ((IPercentageLimit)item.MinLimit).Percentage);
2395dc131401 * Update unit tests to match change to default min/max limits of equipment items
IBBoard <dev@ibboard.co.uk>
parents: 20
diff changeset
21 Assert.IsTrue(item.MaxLimit is IPercentageLimit);
2395dc131401 * Update unit tests to match change to default min/max limits of equipment items
IBBoard <dev@ibboard.co.uk>
parents: 20
diff changeset
22 Assert.AreEqual(100, ((IPercentageLimit)item.MaxLimit).Percentage);
12
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 }
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 [Test()]
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 public void MinNumberLimitEqualsMaxLimitWhenOnlyMaxLimitSet()
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 {
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 UnitEquipmentItem item = new UnitEquipmentItem(new MockEquipmentItem(), new MockUnitType());
20
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
29 item.MaxLimit = new AbsoluteNumericLimit(1);
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
30 Assert.AreEqual(item.MaxLimit, item.MinLimit);
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
31 }
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
32
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
33 [Test()]
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
34 public void MaxNumberLimitEqualsMinLimitWhenOnlyMinLimitSet()
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
35 {
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
36 UnitEquipmentItem item = new UnitEquipmentItem(new MockEquipmentItem(), new MockUnitType());
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
37 item.MinLimit = new AbsoluteNumericLimit(1);
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
38 Assert.AreEqual(item.MinLimit, item.MaxLimit);
12
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39 }
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
40
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
41 [Test()]
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
42 public void MinNumberLimitUntouchedWhenSetFirst()
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
43 {
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
44 UnitEquipmentItem item = new UnitEquipmentItem(new MockEquipmentItem(), new MockUnitType());
20
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
45 AbsoluteNumericLimit limit = new AbsoluteNumericLimit(1);
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
46 item.MinLimit = limit;
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
47 item.MaxLimit = new AbsoluteNumericLimit(10);
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
48 Assert.AreEqual(limit, item.MinLimit);
12
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
49 }
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
50
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
51 [Test()]
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
52 public void EqualNumberLimitsDoesntFail()
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
53 {
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
54 UnitEquipmentItem item = new UnitEquipmentItem(new MockEquipmentItem(), new MockUnitType());
20
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
55 item.MaxLimit = new AbsoluteNumericLimit(10);
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
56 item.MinLimit = new AbsoluteNumericLimit(10);
12
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
57 item = new UnitEquipmentItem(new MockEquipmentItem(), new MockUnitType());
20
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
58 item.MinLimit = new AbsoluteNumericLimit(10);
beaf7a48a93f Re #198: Create equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 19
diff changeset
59 item.MaxLimit = new AbsoluteNumericLimit(10);
19
9b23e72ba3cf Re #198: Add equipment slots
IBBoard <dev@ibboard.co.uk>
parents: 13
diff changeset
60 }
12
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
61 }
a4e7e938d065 Re #195: Setting max equipment without min may not function correctly
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
62 }