diff API/Factories/Requirement/UnitRequiresNUnitsForMUnitsRequirementFactoryTest.cs @ 208:c323770e61c2

Re #379: Fix validation of requirements to check for unit * Rename classes in tests to match API changes * Alter tests to match new API (all classes require at least one UnitType that they're relevant to now)
author IBBoard <dev@ibboard.co.uk>
date Wed, 22 Feb 2012 20:48:40 +0000
parents 43b571aa4124
children e173c5512067
line wrap: on
line diff
--- a/API/Factories/Requirement/UnitRequiresNUnitsForMUnitsRequirementFactoryTest.cs	Tue Jan 31 20:59:15 2012 +0000
+++ b/API/Factories/Requirement/UnitRequiresNUnitsForMUnitsRequirementFactoryTest.cs	Wed Feb 22 20:48:40 2012 +0000
@@ -12,7 +12,7 @@
 namespace IBBoard.WarFoundry.API.Factories.Requirement
 {
 	[TestFixture()]
-	public class UnitUnitRequiresNUnitsForMUnitsRequirementFactoryTest
+	public class UnitRequiresNUnitsForMUnitsRequirementFactoryTest
 	{
 		private static Race race;
 		private static string typeID1 = "unit1";
@@ -47,7 +47,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType1);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1, raceFactory);
 			Assert.That(req, Is.EqualTo(expectedReq));
@@ -58,7 +58,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType1);
 			expectedReq.AddUnitTypeRequirement(unitType2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + "|" + typeID2, raceFactory);
@@ -70,7 +70,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType1);
 			expectedReq.AddUnitTypeRequirement(unitType2);
 			expectedReq.AddUnitTypeRequirement(unitType3);
@@ -83,7 +83,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType1, 2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ":2", raceFactory);
 			Assert.That(req, Is.EqualTo(expectedReq));
@@ -94,7 +94,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType1, 2, 3);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ":2;3", raceFactory);
 			Assert.That(req, Is.EqualTo(expectedReq));
@@ -105,7 +105,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType1, 2);
 			expectedReq.AddUnitTypeRequirement(unitType2, 3);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ":2|" + typeID2 + ":3", raceFactory);
@@ -117,7 +117,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType1, 2);
 			expectedReq.AddUnitTypeRequirement(unitType2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ":2|" + typeID2, raceFactory);
@@ -129,7 +129,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType1);
 			expectedReq.AddUnitTypeRequirement(unitType2, 3);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + "|" + typeID2 + ":3", raceFactory);
@@ -151,7 +151,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			factory.CreateRequirement(unitType, typeID1+":a", raceFactory);
+			factory.CreateRequirement(unitType, typeID1 + ":a", raceFactory);
 		}
 
 		[Test()]
@@ -177,7 +177,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2, raceFactory);
 			Assert.That(req, Is.EqualTo(expectedReq));
@@ -188,7 +188,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType1, unitType2, unitType3);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ";" + typeID3, raceFactory);
 			Assert.That(req, Is.EqualTo(expectedReq));
@@ -199,7 +199,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
 			expectedReq.AddUnitTypeRequirement(unitType2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2, raceFactory);
@@ -211,7 +211,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(2, unitType1, unitType2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":2", raceFactory);
 			Assert.That(req, Is.EqualTo(expectedReq));
@@ -222,7 +222,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(2, 3, unitType1, unitType2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":2;3", raceFactory);
 			Assert.That(req, Is.EqualTo(expectedReq));
@@ -233,7 +233,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(2, unitType1, unitType2);
 			expectedReq.AddUnitTypeRequirement(3, unitType2, unitType1);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":2|" + typeID2 + ";" + typeID1 + ":3", raceFactory);
@@ -245,7 +245,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(2, unitType1, unitType2);
 			expectedReq.AddUnitTypeRequirement(unitType2, unitType1);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":2|" + typeID2 + ";" + typeID1, raceFactory);
@@ -257,7 +257,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
 			expectedReq.AddUnitTypeRequirement(3, unitType2, unitType1);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2 + ";" + typeID1 + ":3", raceFactory);
@@ -269,7 +269,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
 			expectedReq.AddUnitTypeRequirement(unitType2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2, raceFactory);
@@ -281,7 +281,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType2);
 			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID2 + "|" + typeID1 + ";" + typeID2, raceFactory);
@@ -293,7 +293,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
 			expectedReq.AddUnitTypeRequirement(unitType2, 3);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2 + ":3", raceFactory);
@@ -305,7 +305,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType2, 3);
 			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID2 + ":3|" + typeID1 + ";" + typeID2, raceFactory);
@@ -317,7 +317,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(3, unitType1, unitType2);
 			expectedReq.AddUnitTypeRequirement(unitType2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":3|" + typeID2, raceFactory);
@@ -329,7 +329,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType2);
 			expectedReq.AddUnitTypeRequirement(3, unitType1, unitType2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID2 + "|" + typeID1 + ";" + typeID2 + ":3", raceFactory);
@@ -341,7 +341,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
 			expectedReq.AddUnitTypeRequirement(3, 2, unitType2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + "|" + typeID2 + ":3;2", raceFactory);
@@ -353,10 +353,10 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(3, 2, unitType2);
 			expectedReq.AddUnitTypeRequirement(unitType1, unitType2);
-			IRequirement req = factory.CreateRequirement(unitType, typeID2  + ":3;2|" + typeID1 + ";" + typeID2, raceFactory);
+			IRequirement req = factory.CreateRequirement(unitType, typeID2 + ":3;2|" + typeID1 + ";" + typeID2, raceFactory);
 			Assert.That(req, Is.EqualTo(expectedReq));
 		}
 
@@ -365,7 +365,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(3, 2, unitType1, unitType2);
 			expectedReq.AddUnitTypeRequirement(unitType2, 3);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":3;2|" + typeID2 + ":3", raceFactory);
@@ -377,7 +377,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType2, 3);
 			expectedReq.AddUnitTypeRequirement(3, 2, unitType1, unitType2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID2 + ":3|" + typeID1 + ";" + typeID2 + ":3;2", raceFactory);
@@ -389,7 +389,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(3, unitType1, unitType2);
 			expectedReq.AddUnitTypeRequirement(unitType2, 3, 2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID1 + ";" + typeID2 + ":3|" + typeID2 + ":3;2", raceFactory);
@@ -401,7 +401,7 @@
 		{
 			UnitRequiresNUnitsForMUnitsRequirementFactory factory = new UnitRequiresNUnitsForMUnitsRequirementFactory();
 			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
-			RequiresNUnitsForMUnitsRequirement expectedReq = new RequiresNUnitsForMUnitsRequirement(unitType);
+			UnitRequiresNUnitsForMUnitsRequirement expectedReq = new UnitRequiresNUnitsForMUnitsRequirement(unitType);
 			expectedReq.AddUnitTypeRequirement(unitType2, 3, 2);
 			expectedReq.AddUnitTypeRequirement(3, unitType1, unitType2);
 			IRequirement req = factory.CreateRequirement(unitType, typeID2 + ":3;2|" + typeID1 + ";" + typeID2 + ":3", raceFactory);