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 wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/API/Objects/GameSystemTest.cs	Sun Feb 13 21:02:47 2011 +0000
@@ -0,0 +1,73 @@
+using System;
+using NUnit.Framework;
+using IBBoard.WarFoundry.API.Factories;
+using NUnit.Framework.SyntaxHelpers;
+
+namespace IBBoard.WarFoundry.API.Objects
+{
+	[TestFixture()]
+	public class GameSystemTest
+	{
+		[Test()]
+		public void TestPointsSingularAbbreviation ()
+		{
+			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
+			Assert.That(system.GetPointsAbbrev(1), Is.EqualTo(""));
+			system.SystemPtsAbbrevSingle = "pt";
+			system.SystemPtsAbbrevPlural = "pts";
+			Assert.That(system.GetPointsAbbrev(1), Is.EqualTo("pt"));
+		}
+		
+		[Test()]
+		public void TestPointsPluralAbbreviation ()
+		{
+			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
+			Assert.That(system.GetPointsAbbrev(2), Is.EqualTo(""));
+			system.SystemPtsAbbrevSingle = "pt";
+			system.SystemPtsAbbrevPlural = "pts";
+			Assert.That(system.GetPointsAbbrev(2), Is.EqualTo("pts"));
+		}
+		
+		[Test()]
+		public void TestPointsZeroAbbreviation ()
+		{
+			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
+			Assert.That(system.GetPointsAbbrev(0), Is.EqualTo(""));
+			system.SystemPtsAbbrevSingle = "pt";
+			system.SystemPtsAbbrevPlural = "pts";
+			Assert.That(system.GetPointsAbbrev(0), Is.EqualTo("pts"));
+		}
+		
+		[Test()]
+		public void TestPointsSingularName ()
+		{
+			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
+			Assert.That(system.GetPointsName(1), Is.EqualTo(""));
+			system.SystemPtsNameSingle = "pt";
+			system.SystemPtsNamePlural = "pts";
+			Assert.That(system.GetPointsName(1), Is.EqualTo("pt"));
+		}
+		
+		[Test()]
+		public void TestPointsPluralName ()
+		{
+			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
+			Assert.That(system.GetPointsName(2), Is.EqualTo(""));
+			system.SystemPtsNameSingle = "pt";
+			system.SystemPtsNamePlural = "pts";
+			Assert.That(system.GetPointsName(2), Is.EqualTo("pts"));
+		}
+		
+		[Test()]
+		public void TestPointsZeroName ()
+		{
+			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
+			Assert.That(system.GetPointsName(0), Is.EqualTo(""));
+			system.SystemPtsNameSingle = "pt";
+			system.SystemPtsNamePlural = "pts";
+			Assert.That(system.GetPointsName(0), Is.EqualTo("pts"));
+		}
+		
+	}
+}
+
--- a/IBBoard.WarFoundry.API.Tests.csproj	Wed Jan 26 20:24:35 2011 +0000
+++ b/IBBoard.WarFoundry.API.Tests.csproj	Sun Feb 13 21:02:47 2011 +0000
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -17,7 +17,7 @@
     <OldToolsVersion>2.0</OldToolsVersion>
     <TargetFrameworkSubset>
     </TargetFrameworkSubset>
-    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -72,6 +72,7 @@
     <Compile Include="API\Factories\Xml\WarFoundryXmlSystemFactoryTest.cs" />
     <Compile Include="MockObjects\MockWarFoundryLoader.cs" />
     <Compile Include="API\AbstractWarFoundryLoaderTests.cs" />
+    <Compile Include="API\Objects\GameSystemTest.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="app.config" />