changeset 82:bbcc46371364

Re #99: Define "points" values in GameSystem * Add unit tests
author IBBoard <dev@ibboard.co.uk>
date Sun, 13 Feb 2011 21:02:47 +0000
parents eb62004d8a35
children e49f7cdff479
files API/Objects/GameSystemTest.cs IBBoard.WarFoundry.API.Tests.csproj
diffstat 2 files changed, 77 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/API/Objects/GameSystemTest.cs	Sun Feb 13 21:02:47 2011 +0000
     1.3 @@ -0,0 +1,73 @@
     1.4 +using System;
     1.5 +using NUnit.Framework;
     1.6 +using IBBoard.WarFoundry.API.Factories;
     1.7 +using NUnit.Framework.SyntaxHelpers;
     1.8 +
     1.9 +namespace IBBoard.WarFoundry.API.Objects
    1.10 +{
    1.11 +	[TestFixture()]
    1.12 +	public class GameSystemTest
    1.13 +	{
    1.14 +		[Test()]
    1.15 +		public void TestPointsSingularAbbreviation ()
    1.16 +		{
    1.17 +			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
    1.18 +			Assert.That(system.GetPointsAbbrev(1), Is.EqualTo(""));
    1.19 +			system.SystemPtsAbbrevSingle = "pt";
    1.20 +			system.SystemPtsAbbrevPlural = "pts";
    1.21 +			Assert.That(system.GetPointsAbbrev(1), Is.EqualTo("pt"));
    1.22 +		}
    1.23 +		
    1.24 +		[Test()]
    1.25 +		public void TestPointsPluralAbbreviation ()
    1.26 +		{
    1.27 +			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
    1.28 +			Assert.That(system.GetPointsAbbrev(2), Is.EqualTo(""));
    1.29 +			system.SystemPtsAbbrevSingle = "pt";
    1.30 +			system.SystemPtsAbbrevPlural = "pts";
    1.31 +			Assert.That(system.GetPointsAbbrev(2), Is.EqualTo("pts"));
    1.32 +		}
    1.33 +		
    1.34 +		[Test()]
    1.35 +		public void TestPointsZeroAbbreviation ()
    1.36 +		{
    1.37 +			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
    1.38 +			Assert.That(system.GetPointsAbbrev(0), Is.EqualTo(""));
    1.39 +			system.SystemPtsAbbrevSingle = "pt";
    1.40 +			system.SystemPtsAbbrevPlural = "pts";
    1.41 +			Assert.That(system.GetPointsAbbrev(0), Is.EqualTo("pts"));
    1.42 +		}
    1.43 +		
    1.44 +		[Test()]
    1.45 +		public void TestPointsSingularName ()
    1.46 +		{
    1.47 +			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
    1.48 +			Assert.That(system.GetPointsName(1), Is.EqualTo(""));
    1.49 +			system.SystemPtsNameSingle = "pt";
    1.50 +			system.SystemPtsNamePlural = "pts";
    1.51 +			Assert.That(system.GetPointsName(1), Is.EqualTo("pt"));
    1.52 +		}
    1.53 +		
    1.54 +		[Test()]
    1.55 +		public void TestPointsPluralName ()
    1.56 +		{
    1.57 +			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
    1.58 +			Assert.That(system.GetPointsName(2), Is.EqualTo(""));
    1.59 +			system.SystemPtsNameSingle = "pt";
    1.60 +			system.SystemPtsNamePlural = "pts";
    1.61 +			Assert.That(system.GetPointsName(2), Is.EqualTo("pts"));
    1.62 +		}
    1.63 +		
    1.64 +		[Test()]
    1.65 +		public void TestPointsZeroName ()
    1.66 +		{
    1.67 +			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
    1.68 +			Assert.That(system.GetPointsName(0), Is.EqualTo(""));
    1.69 +			system.SystemPtsNameSingle = "pt";
    1.70 +			system.SystemPtsNamePlural = "pts";
    1.71 +			Assert.That(system.GetPointsName(0), Is.EqualTo("pts"));
    1.72 +		}
    1.73 +		
    1.74 +	}
    1.75 +}
    1.76 +
     2.1 --- a/IBBoard.WarFoundry.API.Tests.csproj	Wed Jan 26 20:24:35 2011 +0000
     2.2 +++ b/IBBoard.WarFoundry.API.Tests.csproj	Sun Feb 13 21:02:47 2011 +0000
     2.3 @@ -1,5 +1,5 @@
     2.4 -<?xml version="1.0" encoding="utf-8"?>
     2.5 -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
     2.6 +<?xml version="1.0" encoding="utf-8"?>
     2.7 +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     2.8    <PropertyGroup>
     2.9      <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    2.10      <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    2.11 @@ -17,7 +17,7 @@
    2.12      <OldToolsVersion>2.0</OldToolsVersion>
    2.13      <TargetFrameworkSubset>
    2.14      </TargetFrameworkSubset>
    2.15 -    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    2.16 +    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    2.17    </PropertyGroup>
    2.18    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    2.19      <DebugSymbols>true</DebugSymbols>
    2.20 @@ -72,6 +72,7 @@
    2.21      <Compile Include="API\Factories\Xml\WarFoundryXmlSystemFactoryTest.cs" />
    2.22      <Compile Include="MockObjects\MockWarFoundryLoader.cs" />
    2.23      <Compile Include="API\AbstractWarFoundryLoaderTests.cs" />
    2.24 +    <Compile Include="API\Objects\GameSystemTest.cs" />
    2.25    </ItemGroup>
    2.26    <ItemGroup>
    2.27      <None Include="app.config" />