comparison API/Objects/UnitTypeTest.cs @ 140:2ae80631ec9c

* Remove duplicate equality test code now that Mike Krueger fixed MonoDevelop bug 677228 (https://bugzilla.novell.com/show_bug.cgi?id=677228#c5) no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Thu, 28 Apr 2011 13:36:16 +0000
parents 081b48413f6d
children c323770e61c2
comparison
equal deleted inserted replaced
139:3e4864e206ea 140:2ae80631ec9c
13 namespace IBBoard.WarFoundry.API.Objects 13 namespace IBBoard.WarFoundry.API.Objects
14 { 14 {
15 [TestFixture()] 15 [TestFixture()]
16 public class UnitTypeTest : AbstractEqualityTest<UnitType> 16 public class UnitTypeTest : AbstractEqualityTest<UnitType>
17 { 17 {
18 //FIXME We shouldn't duplicate these tests, but it is broken at the moment
19 [Test]
20 public void TestEquality()
21 {
22 Assert.AreEqual(GetObject(), GetSameObject());
23 Assert.AreEqual(GetSameObject(), GetObject());
24 }
25
26 [Test]
27 public void TestInequality()
28 {
29 Assert.AreNotEqual(GetObject(), GetDifferentObject());
30 Assert.AreNotEqual(GetSameObject(), GetDifferentObject());
31 Assert.AreNotEqual(GetDifferentObject(), GetObject());
32 Assert.AreNotEqual(GetDifferentObject(), GetSameObject());
33 }
34
35 [Test]
36 public void TestReflexiveEquality()
37 {
38 Assert.AreEqual(GetObject(), GetObject());
39 Assert.AreEqual(GetSameObject(), GetSameObject());
40 Assert.AreEqual(GetDifferentObject(), GetDifferentObject());
41 }
42
43 [Test]
44 public void TestOtherInequality()
45 {
46 MethodInfo[] methodInfo = GetType().GetMethods();
47 UnitType obj = GetObject();
48
49 foreach (MethodInfo method in methodInfo)
50 {
51 if (method.Name.StartsWith("GetOtherDifferent"))
52 {
53 UnitType otherObj = (UnitType)method.Invoke(this, new object[0]);
54 Assert.AreNotEqual(obj, otherObj, "Objects equal for "+method.Name);
55 Assert.AreNotEqual(otherObj, obj, "Objects equal for "+method.Name);
56 }
57 }
58 }
59
60
61
62
63 [Test()] 18 [Test()]
64 public void TestSettingMainCategorySetsCategoriesCollection() 19 public void TestSettingMainCategorySetsCategoriesCollection()
65 { 20 {
66 UnitType unitType = new UnitType("unittype1", "Swordsmen", new MockRace()); 21 UnitType unitType = new UnitType("unittype1", "Swordsmen", new MockRace());
67 MockCategory mockCategory = MockCategory.GetCategory(); 22 MockCategory mockCategory = MockCategory.GetCategory();