view API/Objects/GameSystemTest.cs @ 140:2ae80631ec9c

* Remove duplicate equality test code now that Mike Krueger fixed MonoDevelop bug 677228 (https://bugzilla.novell.com/show_bug.cgi?id=677228#c5) no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Thu, 28 Apr 2011 13:36:16 +0000
parents 081b48413f6d
children
line wrap: on
line source

using System;
using NUnit.Framework;
using IBBoard.WarFoundry.API.Factories;
using NUnit.Framework.SyntaxHelpers;
using System.Reflection;
using IBBoard.NUnit;

namespace IBBoard.WarFoundry.API.Objects
{
	[TestFixture()]
	public class GameSystemTest : AbstractEqualityTest<GameSystem>
	{
		[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"));
		}
		
		[Test()]
		public void TestPointsSingularNameFallsBackToPlural ()
		{
			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
			Assert.That(system.GetPointsName(1), Is.EqualTo(""));
			system.SystemPtsNamePlural = "pts";
			Assert.That(system.GetPointsName(1), Is.EqualTo("pts"));
		}
		
		[Test()]
		public void TestPointsPluralNameFallsBackToSingular ()
		{
			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
			Assert.That(system.GetPointsName(2), Is.EqualTo(""));
			system.SystemPtsNameSingle = "pt";
			Assert.That(system.GetPointsName(2), Is.EqualTo("pt"));
		}
		
		[Test()]
		public void TestPointsZeroNameFallsBackToSingular ()
		{
			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
			Assert.That(system.GetPointsName(0), Is.EqualTo(""));
			system.SystemPtsNameSingle = "pt";
			Assert.That(system.GetPointsName(0), Is.EqualTo("pt"));
		}
		
		[Test()]
		public void TestPointsSingularAbbreviationFallsBackToPlural ()
		{
			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
			Assert.That(system.GetPointsAbbrev(1), Is.EqualTo(""));
			system.SystemPtsAbbrevPlural = "pts";
			Assert.That(system.GetPointsAbbrev(1), Is.EqualTo("pts"));
		}
		
		[Test()]
		public void TestPointsPluralAbbreviationFallsBackToSingular ()
		{
			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
			Assert.That(system.GetPointsAbbrev(2), Is.EqualTo(""));
			system.SystemPtsAbbrevSingle = "pt";
			Assert.That(system.GetPointsAbbrev(2), Is.EqualTo("pt"));
		}
		
		[Test()]
		public void TestPointsZeroAbbreviationFallsBackToSingular ()
		{
			GameSystem system = new GameSystem("id", "name", new DummyWarFoundryFactory());
			Assert.That(system.GetPointsAbbrev(0), Is.EqualTo(""));
			system.SystemPtsAbbrevSingle = "pt";
			Assert.That(system.GetPointsAbbrev(0), Is.EqualTo("pt"));
		}

		public override GameSystem GetObject ()
		{
			DummyWarFoundryFactory factory = new DummyWarFoundryFactory();
			return new GameSystem("system", "system", factory);
		}

		public override GameSystem GetSameObject ()
		{
			DummyWarFoundryFactory factory = new DummyWarFoundryFactory();
			return new GameSystem("system", "system", factory);
		}

		public override GameSystem GetDifferentObject ()
		{
			DummyWarFoundryFactory factory = new DummyWarFoundryFactory();
			return new GameSystem("system2", "another system", factory);
		}
	}
}