diff API/Factories/Requirement/UnitRequiresAtLeastNUnitsRequirementFactoryTest.cs @ 152:dd283afa5971

Re #351: Add extensible requirement handling method * Add first test for failed loading
author IBBoard <dev@ibboard.co.uk>
date Sat, 02 Jul 2011 15:00:16 +0000
parents 60de02ce78d8
children e84149f37478
line wrap: on
line diff
--- a/API/Factories/Requirement/UnitRequiresAtLeastNUnitsRequirementFactoryTest.cs	Tue Jun 14 14:26:18 2011 +0000
+++ b/API/Factories/Requirement/UnitRequiresAtLeastNUnitsRequirementFactoryTest.cs	Sat Jul 02 15:00:16 2011 +0000
@@ -33,7 +33,7 @@
 		public void TestCreatesRequirement()
 		{
 			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
-			Assert.That(factory.CreateRequirement(new MockUnitType(), typeID1), Is.Not.Null);
+			Assert.That(factory.CreateRequirement(unitType2, typeID1), Is.Not.Null);
 		}
 
 		[Test()]
@@ -106,7 +106,14 @@
 			Assert.That(req, Is.EqualTo(expectedReq));
 		}
 
-		//TODO Test invalid data (e.g. non-number) and throw appropriate exceptions
+		[Test()]
+		[ExpectedException()]
+		public void TestCreatesCorrectRequirementForInvalidID()
+		{
+			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
+			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
+			factory.CreateRequirement(unitType, "fibble");
+		}
 	}
 }