changeset 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
files API/Factories/Requirement/UnitRequiresAtLeastNUnitsRequirementFactoryTest.cs
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/API/Factories/Requirement/UnitRequiresAtLeastNUnitsRequirementFactoryTest.cs	Tue Jun 14 14:26:18 2011 +0000
     1.2 +++ b/API/Factories/Requirement/UnitRequiresAtLeastNUnitsRequirementFactoryTest.cs	Sat Jul 02 15:00:16 2011 +0000
     1.3 @@ -33,7 +33,7 @@
     1.4  		public void TestCreatesRequirement()
     1.5  		{
     1.6  			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
     1.7 -			Assert.That(factory.CreateRequirement(new MockUnitType(), typeID1), Is.Not.Null);
     1.8 +			Assert.That(factory.CreateRequirement(unitType2, typeID1), Is.Not.Null);
     1.9  		}
    1.10  
    1.11  		[Test()]
    1.12 @@ -106,7 +106,14 @@
    1.13  			Assert.That(req, Is.EqualTo(expectedReq));
    1.14  		}
    1.15  
    1.16 -		//TODO Test invalid data (e.g. non-number) and throw appropriate exceptions
    1.17 +		[Test()]
    1.18 +		[ExpectedException()]
    1.19 +		public void TestCreatesCorrectRequirementForInvalidID()
    1.20 +		{
    1.21 +			UnitRequiresAtLeastNUnitsRequirementFactory factory = new UnitRequiresAtLeastNUnitsRequirementFactory();
    1.22 +			UnitType unitType = new UnitType("testUnit", "Test Unit", race);
    1.23 +			factory.CreateRequirement(unitType, "fibble");
    1.24 +		}
    1.25  	}
    1.26  }
    1.27