diff ArraysTests.cs @ 27:16c28954b559

* Start to unit test array utility methods before refactoring them to bring them up to date * Add some Preference-related tests that have been hanging around for a while no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Tue, 17 Aug 2010 20:02:13 +0000
parents
children 9bdfaf717b58
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ArraysTests.cs	Tue Aug 17 20:02:13 2010 +0000
@@ -0,0 +1,38 @@
+//  This file (ArraysTests.cs) is a part of the IBBoard.Tests project and is copyright 2010 IBBoard
+// 
+//  // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
+using System;
+using NUnit.Framework;
+using NUnit.Framework.SyntaxHelpers;
+namespace IBBoard
+{
+	[TestFixture()]
+	public class ArraysTests
+	{
+		private static readonly string STRING_ONE = "one";
+		private static readonly string STRING_TWO = "two";
+		private static readonly string STRING_THREE = "three";
+		private static readonly string STRING_FOUR = "four";
+		private static readonly string[] THREE_ITEM_ARRAY = new string[] {
+			STRING_ONE,
+			STRING_TWO,
+			STRING_THREE
+		};
+		private static readonly string[] ONE_ITEM_ARRAY = new string[] { STRING_FOUR };
+		
+		[Test()]
+		public void TestSubtractWithNoOverlapLeavesSameArray()
+		{
+			Assert.That(Arrays.Subtract(THREE_ITEM_ARRAY, ONE_ITEM_ARRAY), Is.EqualTo(THREE_ITEM_ARRAY));
+			Assert.That(Arrays.Subtract(ONE_ITEM_ARRAY, THREE_ITEM_ARRAY), Is.EqualTo(ONE_ITEM_ARRAY));
+		}
+		
+		[Test()]
+		public void TestSubtractWithFullOverlapLeaveEmptyArray()
+		{
+			Assert.That(Arrays.Subtract(THREE_ITEM_ARRAY, THREE_ITEM_ARRAY), Has.Length(0));
+			Assert.That(Arrays.Subtract(ONE_ITEM_ARRAY, ONE_ITEM_ARRAY), Has.Length(0));
+		}
+	}
+}
+