Explorar o código

NAnt build files and test cases that CVS is giving me problems with.

svn path=/trunk/mcs/; revision=974
Sean MacIsaac %!s(int64=24) %!d(string=hai) anos
pai
achega
a3cfee175f

+ 1 - 0
mcs/class/corlib/Test/.cvsignore

@@ -0,0 +1 @@
+*.dll

+ 152 - 0
mcs/class/corlib/Test/System.Collections/HashtableTest.cs

@@ -0,0 +1,152 @@
+// TODO: add tests for Comparer and HashCodeProvider
+
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+
+namespace Testsuite.System.Collections {
+
+
+	/// <summary>Hashtable test.</summary>
+	public class HashtableTest {
+		public static ITest Suite {
+			get {
+				TestSuite suite= new TestSuite("All Hashtable Tests");
+				suite.AddTest(BasicOperationsTest.Suite);
+				return suite;
+			}
+		}
+	}
+
+
+
+
+	public class BasicOperationsTest : TestCase {
+
+		protected Hashtable ht;
+		private static Random rnd;
+
+		public BasicOperationsTest(String name) : base(name) {}
+
+		protected override void SetUp() {
+			ht=new Hashtable();
+			rnd=new Random();
+		}
+
+		public static ITest Suite {
+			get {
+				return new TestSuite(typeof(BasicOperationsTest));
+			}
+		}
+
+
+
+		private void SetDefaultData() {
+			ht.Clear();
+			ht.Add("k1","another");
+			ht.Add("k2","yet");
+			ht.Add("k3","hashtable");
+		}
+
+
+		public void TestAddRemoveClear() {
+			ht.Clear();
+			Assert(ht.Count==0);
+
+			SetDefaultData();
+			Assert(ht.Count==3);
+
+			bool thrown=false;
+			try {
+				ht.Add("k2","cool");
+			} catch (ArgumentException) {thrown=true;}
+			Assert("Must throw ArgumentException!",thrown);
+
+			ht["k2"]="cool";
+			Assert(ht.Count==3);
+			Assert(ht["k2"].Equals("cool"));
+
+		}
+
+		public void TestCopyTo() {
+			SetDefaultData();
+			Object[] entries=new Object[ht.Count];
+			ht.CopyTo(entries,0);
+			Assert("Not an entry.",entries[0] is DictionaryEntry);
+		}
+
+
+		public void TestUnderHeavyLoad() {
+			Console.WriteLine("Testing "+ht);
+			ht.Clear();
+			int max=100000;
+			String[] cache=new String[max*2];
+			int n=0;
+
+			for (int i=0;i<max;i++) {
+				int id=rnd.Next()&0xFFFF;
+				String key=""+id+"-key-"+id;
+				String val="value-"+id;
+				if (ht[key]==null) {
+					ht[key]=val;
+					cache[n]=key;
+					cache[n+max]=val;
+					n++;
+				}
+			}
+
+			Assert(ht.Count==n);
+
+			for (int i=0;i<n;i++) {
+				String key=cache[i];
+				String val=ht[key] as String;
+				String err="ht[\""+key+"\"]=\""+val+
+				      "\", expected \""+cache[i+max]+"\"";
+				Assert(err,val!=null && val.Equals(cache[i+max]));
+			}
+
+			int r1=(n/3);
+			int r2=r1+(n/5);
+
+			for (int i=r1;i<r2;i++) {
+				ht.Remove(cache[i]);
+			}
+
+
+			for (int i=0;i<n;i++) {
+				if (i>=r1 && i<r2) {
+					Assert(ht[cache[i]]==null);
+				} else {
+					String key=cache[i];
+					String val=ht[key] as String;
+					String err="ht[\""+key+"\"]=\""+val+
+					      "\", expected \""+cache[i+max]+"\"";
+					Assert(err,val!=null && val.Equals(cache[i+max]));
+				}
+			}
+
+			ICollection keys=ht.Keys;
+			int nKeys=0;
+			foreach (Object key in keys) {
+				Assert((key as String) != null);
+				nKeys++;
+			}
+			Assert(nKeys==ht.Count);
+
+
+			ICollection vals=ht.Values;
+			int nVals=0;
+			foreach (Object val in vals) {
+				Assert((val as String) != null);
+				nVals++;
+			}
+			Assert(nVals==ht.Count);
+
+		}
+
+	}
+}

+ 31 - 0
mcs/class/corlib/Test/corlib_test.build

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<!-- NAnt build file for corlib_test.dll -->
+<!-- Target build (default) builds tests -->
+<!-- Target test runs tests -->
+
+<project name="corlib_test" default="build">
+	<property name="debug" value="false"/>
+	<property name="nunit_home" value="..\..\..\nunit"/>
+
+	<target name="build">
+		<csc target="library" output="corlib_test.dll" debug="${debug}">
+			<sources>
+				<includes name="**/*.cs"/>
+				<excludes name="Old/HashtableTest.cs"/>
+				<excludes name="Old/QueueTest.cs"/>
+			</sources>
+			<references basedir="..\..\..\nunit">
+				<includes name="NUnitCore.dll"/>
+			</references>
+		</csc>
+	</target>
+
+	<target name="test" depends="build">
+		<exec program="..\..\..\nunit\NUnitConsole" commandline="Ximian.Mono.Tests.AllTests,corlib_test.dll" failonerror="false"/>
+	</target>
+
+	<target name="clean">
+		<delete file="corlib_test.dll" failonerror="false"/>
+	</target>
+</project>

+ 46 - 0
mcs/class/corlib/Test/temp/AllTests.cs

@@ -0,0 +1,46 @@
+//
+// Ximian.Mono.Tests.AllTests.cs
+//
+// Author:
+//      Alexander Klyubin ([email protected])
+//
+// (C) 2001
+//
+
+using System;
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests {
+        /// <summary>
+        ///   Combines all available unit tests into one test suite.
+        /// </summary>
+        public class AllTests : TestCase {
+                public AllTests(string name) : base(name) {}
+                
+                public static ITest Suite 
+                { 
+                        get 
+                        {
+                                TestSuite suite =  new TestSuite();
+                                suite.AddTest(new TestSuite(typeof(BitArrayTest)));
+                                suite.AddTest(Testsuite.System.Collections.CaseInsensitiveComparerTest.Suite);
+                                suite.AddTest(Testsuite.System.Collections.CaseInsensitiveHashCodeProviderTest.Suite);
+                                suite.AddTest(CollectionBaseTest.Suite);
+                                suite.AddTest(Testsuite.System.Collections.ComparerTest.Suite);
+                                suite.AddTest(Testsuite.System.Collections.HashtableTest.Suite);
+                                suite.AddTest(new TestSuite(typeof(MemoryStreamTest)));
+                                suite.AddTest(new TestSuite(typeof(PathTest)));
+                                // suite.AddTest(Testsuite.System.Collections.QueueTest.Suite);
+                                suite.AddTest(new TestSuite(typeof(RandomTest)));
+                                suite.AddTest(ReadOnlyCollectionBaseTest.Suite);
+                                suite.AddTest(StackTest.Suite);
+                                suite.AddTest(StackFrameTest.Suite);
+                                suite.AddTest(StackTraceTest.Suite);
+                                suite.AddTest(new TestSuite(typeof(StringBuilderTest)));
+                                suite.AddTest(new TestSuite(typeof(StringReaderTest)));
+                                suite.AddTest(new TestSuite(typeof(StringWriterTest)));
+                                return suite;
+                        }
+                }
+        }
+}

+ 272 - 0
mcs/class/corlib/Test/temp/BitArrayTest.cs

@@ -0,0 +1,272 @@
+//
+// BitArrayTest.cs - NUnit Test Cases for the System.Collections.BitArray class
+// 
+// Author: David Menestrina ([email protected])
+//
+
+using NUnit.Framework;
+using System.Collections;
+using System;
+
+public class BitArrayTest : TestCase 
+{
+  private BitArray testBa;
+  private bool [] testPattern;
+  private BitArray op1;
+  private BitArray op2;
+
+  private void verifyPattern(BitArray ba, bool[] pattern)
+  {
+    AssertEquals(ba.Length, pattern.Length);
+    for (int i = 0; i < pattern.Length; i++)
+      AssertEquals(ba[i], pattern[i]);
+  }
+
+  public BitArrayTest( string name ) : base(name) { }	
+  
+  protected override void SetUp()
+  {
+    testPattern = new bool[70];
+
+    int i;
+    for(i = 0; i < testPattern.Length/2; i++)
+      testPattern[i] = ((i % 2) == 0);
+    for(; i < testPattern.Length; i++)
+      testPattern[i] = ((i % 2) != 0);
+
+    testBa = new BitArray(70);
+    for(i = 0; i < testBa.Length/2; i++)
+      testBa[i] = ((i % 2) == 0);
+    for(; i < testBa.Length; i++)
+      testBa[i] = ((i % 2) != 0);
+
+    // for TestAnd, TestOr, TestNot, TestXor
+    op1 = new BitArray(new int[] { 0x33333333, 0x33333333 });
+    op2 = new BitArray(new int[] { 0x66666666, 0x66666666 });
+  }
+  
+  public void TestBoolConstructor()
+  {
+    BitArray ba = new BitArray(testPattern);
+    verifyPattern(ba, testPattern);
+  }
+
+  public void TestCopyConstructor() 
+  {
+    BitArray ba = new BitArray(testBa);
+
+    verifyPattern(ba, testPattern);
+  }
+
+  public void TestByteConstructor()
+  {
+    byte [] byteArr = new byte[] { 0xaa, 0x55, 0xaa, 0x55, 0x80 };
+    BitArray ba = new BitArray(byteArr);
+    
+    AssertEquals(ba.Length, byteArr.Length * 8);
+    
+    // spot check
+    Assert(ba[7]);
+    Assert(!ba[6]);
+    Assert(!ba[15]);
+    Assert(ba[14]);
+    Assert(ba[39]);
+    Assert(!ba[35]);
+
+  }
+
+  public void TestIntConstructor()
+  {
+    int [] intArr = new int[] { ~0x55555555, 0x55555551 };
+    BitArray ba = new BitArray(intArr);
+    
+    AssertEquals(ba.Length, intArr.Length * 32);
+    
+    // spot check
+    
+    Assert(ba[31]);
+    Assert(!ba[30]);
+    Assert(!ba[63]);
+    Assert(ba[62]);
+    Assert(ba[32]);
+    Assert(!ba[35]);
+  }
+
+  public void TestValConstructor()
+  {
+    BitArray ba = new BitArray(64, false);
+
+    AssertEquals(ba.Length, 64);
+    foreach (bool b in ba)
+      Assert(!b);
+
+    ba = new BitArray(64, true);
+
+    AssertEquals(ba.Length, 64);
+    foreach (bool b in ba)
+      Assert(b);
+  }
+
+  public void TestClone()
+  {
+    BitArray ba = (BitArray)testBa.Clone();
+
+    verifyPattern(ba, testPattern);
+
+    // ensure that changes in ba don't get propagated to testBa
+    ba[0] = false;
+    ba[1] = false;
+    ba[2] = false;
+    
+    verifyPattern(testBa, testPattern);
+  }
+  
+  public void TestSetLength()
+  {
+    int origLen = testBa.Length;
+    testBa.Length += 33;
+
+    AssertEquals(origLen + 33, testBa.Length);
+    for (int i = origLen; i < testBa.Length; i++)
+      testBa[i] = true;
+
+    testBa.Length -= 33;
+    verifyPattern(testBa, testPattern);
+  }
+
+  public void TestAnd()
+  {
+    BitArray result = op1.And(op2);
+    AssertEquals(result.Length, op1.Length);
+    for (int i = 0; i < result.Length; )
+    {
+      Assert(!result[i++]);
+      Assert(result[i++]);
+      Assert(!result[i++]);
+      Assert(!result[i++]);
+    }
+  }
+
+  public void TestOr()
+  {
+    BitArray result = op1.Or(op2);
+    AssertEquals(result.Length, op1.Length);
+    for (int i = 0; i < result.Length; )
+    {
+      Assert(result[i++]);
+      Assert(result[i++]);
+      Assert(result[i++]);
+      Assert(!result[i++]);
+    }
+  }
+
+  public void TestNot()
+  {
+    BitArray result = op1.Not();
+    AssertEquals(result.Length, op1.Length);
+    for (int i = 0; i < result.Length; )
+    {
+      Assert(!result[i++]);
+      Assert(!result[i++]);
+      Assert(result[i++]);
+      Assert(result[i++]);
+    }
+  }
+
+  public void TestXor()
+  {
+    BitArray result = op1.Xor(op2);
+    AssertEquals(result.Length, op1.Length);
+    for (int i = 0; i < result.Length; )
+    {
+      Assert(result[i++]);
+      Assert(!result[i++]);
+      Assert(result[i++]);
+      Assert(!result[i++]);
+    }
+  }
+
+  public void TestSetAll()
+  {
+    testBa.SetAll(false);
+    foreach(bool b in testBa)
+      Assert(!b);
+    testBa.SetAll(true);
+    foreach(bool b in testBa)
+      Assert(b);
+  }
+
+  public void TestCopyToBool()
+  {
+    bool[] barray = new bool[testBa.Length + 10];
+    
+    testBa.CopyTo(barray, 5);
+
+    for (int i = 0; i < testBa.Length; i++)
+      AssertEquals(testBa[i], barray[i+5]);
+  }
+
+  public void TestCopyToByte()
+  {
+    testBa.Length = 34;
+    byte[] barray = new byte[5 + 10];
+    
+    testBa.CopyTo(barray, 5);
+
+    for (int i = 5; i < 9; i++)
+      AssertEquals(0x55, barray[i] & 0xff);
+
+    // FIXME: MS fails on the next line.  This is because
+    // we truncated testBa.Length, and MS's internal array still
+    // has the old bits set.  CopyTo() doesn't say specifically
+    // whether the "junk" bits (bits past Length, but within Length
+    // rounded up to 32) will be copied as 0, or if those bits are
+    // undefined.
+    //AssertEquals(0x01, barray[9] & 0xff);
+  }
+
+  public void TestCopyToInt()
+  {
+    testBa.Length = 34;
+    int[] iarray = new int[2 + 10];
+    
+    testBa.CopyTo(iarray, 5);
+
+    AssertEquals(0x55555555, iarray[5]);
+    // FIXME:  Same thing here as in TestCopyToByte
+    //AssertEquals(0x01, iarray[6]);
+  }
+
+  public void TestEnumerator()
+  {
+    IEnumerator e = testBa.GetEnumerator();
+    
+    for (int i = 0; e.MoveNext(); i++)
+      AssertEquals(e.Current, testPattern[i]);
+
+    Assert(!e.MoveNext());
+    // read, to make sure reading isn't considered a write.
+    bool b = testBa[0];
+
+    e.Reset();
+    for (int i = 0; e.MoveNext(); i++)
+      AssertEquals(e.Current, testPattern[i]);
+
+    try
+    {
+      e.Reset();
+      testBa[0] = !testBa[0];
+      e.MoveNext();
+      Fail("IEnumerator.MoveNext() should throw when collection modified.");
+    }
+    catch (InvalidOperationException)
+    {
+    }
+  }
+}
+
+
+
+
+
+

+ 62 - 0
mcs/class/corlib/Test/temp/CaseInsensitiveComparerTest.cs

@@ -0,0 +1,62 @@
+// CaseInsensitiveComparerTest
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+
+namespace Testsuite.System.Collections {
+
+
+	/// <summary>CaseInsensitiveComparer test suite.</summary>
+	public class CaseInsensitiveComparerTest {
+		public static ITest Suite {
+			get {
+				TestSuite suite = new TestSuite("CaseInsensitiveComparerTest tests");
+				suite.AddTest(CIComparerTestCase.Suite);
+				return suite;
+			}
+		}
+	}
+
+
+	public class CIComparerTestCase : TestCase {
+
+		public CIComparerTestCase (String name) : base(name)
+		{
+		}
+
+		protected override void SetUp ()
+		{
+		}
+
+		public static ITest Suite
+		{
+			get {
+				Console.WriteLine("Testing " + (new CaseInsensitiveComparer ()));
+				return new TestSuite(typeof(CIComparerTestCase));
+			}
+		}
+
+		public void TestDefaultInstance ()
+		{
+			// Make sure the instance returned by Default
+			// is really a CaseInsensitiveComparer.
+			Assert((CaseInsensitiveComparer.Default
+			        as CaseInsensitiveComparer) != null);
+		}
+
+		public void TestCompare () {
+			CaseInsensitiveComparer cic = new CaseInsensitiveComparer ();
+
+			Assert(cic.Compare ("WILD WEST", "Wild West") == 0);
+			Assert(cic.Compare ("WILD WEST", "wild west") == 0);
+			Assert(cic.Compare ("Zeus", "Mars") > 0);
+			Assert(cic.Compare ("Earth", "Venus") < 0);
+		}
+			
+	}
+
+}

+ 68 - 0
mcs/class/corlib/Test/temp/CaseInsensitiveHashCodeProviderTest.cs

@@ -0,0 +1,68 @@
+// CaseInsensitiveHashCodeProviderTest
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+
+namespace Testsuite.System.Collections {
+
+
+	/// <summary>CaseInsensitiveHashCodeProvider test suite.</summary>
+	public class CaseInsensitiveHashCodeProviderTest {
+		public static ITest Suite {
+			get {
+				TestSuite suite = new TestSuite ("CaseInsensitiveHashCodeProviderTest tests");
+				suite.AddTest (CIHashCodeProviderTestCase.Suite);
+				return suite;
+			}
+		}
+	}
+
+
+	public class CIHashCodeProviderTestCase : TestCase {
+
+		public CIHashCodeProviderTestCase(String name) : base(name)
+		{
+		}
+
+		protected override void SetUp ()
+		{
+		}
+
+		public static ITest Suite
+		{
+			get {
+				Console.WriteLine("Testing " + (new CaseInsensitiveHashCodeProvider()));
+				return new TestSuite(typeof(CIHashCodeProviderTestCase));
+			}
+		}
+
+		public void TestDefaultInstance ()
+		{
+			// Make sure the instance returned by Default
+			// is really a CaseInsensitiveHashCodeProvider.
+			Assert((CaseInsensitiveHashCodeProvider.Default
+			        as CaseInsensitiveHashCodeProvider) != null);
+		}
+
+		public void TestHashCode () {
+			CaseInsensitiveHashCodeProvider cih = new CaseInsensitiveHashCodeProvider ();
+			int h1 = cih.GetHashCode ("Test String");
+			int h2 = cih.GetHashCode ("test string");
+			int h3 = cih.GetHashCode ("TEST STRING");
+
+			Assert("Mixed Case != lower case", h1 == h2);
+			Assert("Mixed Case != UPPER CASE", h1 == h3);
+
+			h1 = cih.GetHashCode ("one");
+			h2 = cih.GetHashCode ("another");
+			// Actually this is quite possible.
+			Assert(h1 != h2);
+		}
+			
+	}
+
+}

+ 231 - 0
mcs/class/corlib/Test/temp/CollectionBaseTest.cs

@@ -0,0 +1,231 @@
+//
+// System.Collections.CollectionBase
+// Test suite for System.Collections.CollectionBase
+//
+// Author:
+//    Nick D. Drochak II
+//
+// (C) 2001 Nick D. Drochak II
+//
+
+
+using System;
+using System.Collections;
+using NUnit.Framework;
+
+public class CollectionBaseTest : TestCase 	
+{
+	public CollectionBaseTest () : base ("System.Collection.CollectionBase testsuite") {}
+	public CollectionBaseTest (String name) : base (name) {}
+
+	// We need a concrete class to test the abstract base class
+	public class ConcreteCollection : CollectionBase 
+	{
+		// These fields are used as markers to test the On* hooks.
+		public bool onClearFired;
+		public bool onClearCompleteFired;
+
+		public bool onInsertFired;
+		public int onInsertIndex;
+		public bool onInsertCompleteFired;
+		public int onInsertCompleteIndex;
+
+		public bool onRemoveFired;
+		public int onRemoveIndex;
+		public bool onRemoveCompleteFired;
+		public int onRemoveCompleteIndex;
+
+		public bool onSetFired;
+		public int onSetOldValue;
+		public int onSetNewValue;
+		public bool onSetCompleteFired;
+		public int onSetCompleteOldValue;
+		public int onSetCompleteNewValue;
+
+		// This constructor is used to test OnValid()
+		public ConcreteCollection()	
+		{
+			IList listObj;
+			listObj = this;
+			listObj.Add(null);
+		}
+
+		// This constructor puts consecutive integers into the list
+		public ConcreteCollection(int i) {
+			IList listObj;
+			listObj = this;
+
+			int j;
+			for (j = 0; j< i; j++) {
+				listObj.Add(j);
+			}
+		}
+
+		// A helper method to look at a value in the list at a specific index
+		public int PeekAt(int index)
+		{
+			IList listObj;
+			listObj = this;
+			return (int) listObj[index];
+		}
+
+		// Mark the flag if this hook is fired
+		protected override void OnClear() {
+			this.onClearFired = true;
+		}
+
+		// Mark the flag if this hook is fired
+		protected override void OnClearComplete() 
+		{
+			this.onClearCompleteFired = true;
+		}
+
+		// Mark the flag, and save the paramter if this hook is fired
+		protected override void OnInsert(int index, object value) 
+		{
+			this.onInsertFired = true;
+			this.onInsertIndex = index;
+		}
+
+		// Mark the flag, and save the paramter if this hook is fired
+		protected override void OnInsertComplete(int index, object value) 
+		{
+			this.onInsertCompleteFired = true;
+			this.onInsertCompleteIndex = index;
+		}
+		
+		// Mark the flag, and save the paramter if this hook is fired
+		protected override void OnRemove(int index, object value) 
+		{
+			this.onRemoveFired = true;
+			this.onRemoveIndex = index;
+		}
+		
+		// Mark the flag, and save the paramter if this hook is fired
+		protected override void OnRemoveComplete(int index, object value) 
+		{
+			this.onRemoveCompleteFired = true;
+			this.onRemoveCompleteIndex = index;
+		}
+		
+		// Mark the flag, and save the paramters if this hook is fired
+		protected override void OnSet(int index, object oldValue, object newValue) 
+		{
+			this.onSetFired = true;
+			this.onSetOldValue = (int) oldValue;
+			this.onSetNewValue = (int) newValue;
+		}
+		
+		// Mark the flag, and save the paramters if this hook is fired
+		protected override void OnSetComplete(int index, object oldValue, object newValue) 
+		{
+			this.onSetCompleteFired = true;
+			this.onSetCompleteOldValue = (int) oldValue;
+			this.onSetCompleteNewValue = (int) newValue;
+		}
+	}  // public class ConcreteCollection
+
+	public static ITest Suite {
+		get {
+			return new TestSuite (typeof(CollectionBaseTest));
+		}
+	}
+
+	// Check the count property
+	public void TestCount() {
+		ConcreteCollection myCollection;
+		myCollection = new ConcreteCollection(4);
+		Assert(4 == myCollection.Count);
+	}
+
+	// Make sure GetEnumerator returns an object
+	public void TestGetEnumerator() {
+		ConcreteCollection myCollection;
+		myCollection = new ConcreteCollection(4);
+		Assert(null != myCollection.GetEnumerator());
+	}
+
+	// OnValid disallows nulls
+	public void TestOnValid() {
+		ConcreteCollection myCollection;
+		try {
+			myCollection = new ConcreteCollection();
+		}
+		catch (System.ArgumentNullException) {
+		}
+	}
+
+	// Test various Insert paths
+	public void TestInsert() {
+		ConcreteCollection myCollection;
+		int numberOfItems;
+		numberOfItems = 3;
+		// The constructor inserts
+		myCollection = new ConcreteCollection(numberOfItems);
+		Assert(myCollection.onInsertFired);
+		Assert(myCollection.onInsertCompleteFired);
+
+		// Using the IList interface, check inserts in the middle
+		IList listObj = myCollection;
+		listObj.Insert(1, 9);
+		Assert(myCollection.onInsertIndex == 1);
+		Assert(myCollection.onInsertCompleteIndex == 1);
+		Assert(myCollection.PeekAt(1) == 9);
+	}
+
+	// Test Clear and it's hooks
+	public void TestClear() 
+	{
+		ConcreteCollection myCollection;
+		int numberOfItems;
+		numberOfItems = 1;
+		myCollection = new ConcreteCollection(numberOfItems);
+		myCollection.Clear();
+		Assert(myCollection.Count == 0);
+		Assert(myCollection.onClearFired);
+		Assert(myCollection.onClearCompleteFired);
+	}
+
+	// Test RemoveAt, other removes and the hooks
+	public void TestRemove() 
+	{
+		ConcreteCollection myCollection;
+		int numberOfItems;
+		numberOfItems = 3;
+		// Set up a test collection
+		myCollection = new ConcreteCollection(numberOfItems);
+
+		// The list is 0-based.  So if we remove the second one
+		myCollection.RemoveAt(1);
+
+		// We should see the original third one in it's place
+		Assert(myCollection.PeekAt(1) == 2);
+		Assert(myCollection.onRemoveFired);
+		Assert(myCollection.onRemoveIndex == 1);
+		Assert(myCollection.onRemoveCompleteFired);
+		Assert(myCollection.onRemoveCompleteIndex == 1);
+		IList listObj = myCollection;
+		listObj.Remove(0);
+		// Confirm parameters are being passed to the hooks
+		Assert(myCollection.onRemoveIndex == 0);
+		Assert(myCollection.onRemoveCompleteIndex == 0);
+	}
+
+	// Test the random access feature
+	public void TestSet() 
+	{
+		ConcreteCollection myCollection;
+		int numberOfItems;
+		numberOfItems = 3;
+		myCollection = new ConcreteCollection(numberOfItems);
+		IList listObj = myCollection;
+		listObj[0] = 99;
+		Assert((int) listObj[0] == 99);
+		Assert(myCollection.onSetFired);
+		Assert(myCollection.onSetCompleteFired);
+		Assert(myCollection.onSetOldValue == 0);
+		Assert(myCollection.onSetCompleteOldValue == 0);
+		Assert(myCollection.onSetNewValue == 99);
+		Assert(myCollection.onSetCompleteNewValue == 99);
+	}
+}

+ 72 - 0
mcs/class/corlib/Test/temp/ComparerTest.cs

@@ -0,0 +1,72 @@
+// ComparerTest
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+
+namespace Testsuite.System.Collections {
+
+
+	/// <summary>Comparer test suite.</summary>
+	public class ComparerTest {
+		public static ITest Suite {
+			get {
+				TestSuite suite = new TestSuite ("Comparer tests");
+				suite.AddTest (ComparerTestCase.Suite);
+				return suite;
+			}
+		}
+	}
+
+
+	public class ComparerTestCase : TestCase {
+
+		public ComparerTestCase (String name) : base(name)
+		{
+		}
+
+		protected override void SetUp ()
+		{
+		}
+
+		public static ITest Suite
+		{
+			get {
+				Console.WriteLine("Testing " + Comparer.Default);
+				return new TestSuite(typeof(ComparerTestCase));
+			}
+		}
+
+		public void TestDefaultInstance ()
+		{
+			// Make sure the instance returned by Default
+			// is really a Comparer.
+			Assert((Comparer.Default as Comparer) != null);
+		}
+
+		public void TestCompare ()
+		{
+			Comparer c = Comparer.Default;
+
+			bool thrown = false;
+
+			try {
+				c.Compare (new Object (), new Object ());
+			} catch (ArgumentException) {
+				thrown = true;
+			}
+
+			Assert("ArgumentException expected", thrown);
+
+			Assert(c.Compare (1, 2) < 0);
+			Assert(c.Compare (2, 2) == 0);
+			Assert(c.Compare (3, 2) > 0);
+
+		}
+			
+	}
+
+}

+ 202 - 0
mcs/class/corlib/Test/temp/HashtableTest.cs

@@ -0,0 +1,202 @@
+// HashtableTest
+
+using System;
+using System.Collections;
+
+using NUnit.Framework;
+
+
+namespace Testsuite.System.Collections {
+
+
+	/// <summary>Hashtable test.</summary>
+	public class HashtableTest {
+		public static ITest Suite {
+			get {
+				TestSuite suite = new TestSuite("All Hashtable tests");
+				suite.AddTest(HTBasicOperationsTest.Suite);
+				return suite;
+			}
+		}
+	}
+
+
+
+
+	public class HTBasicOperationsTest : TestCase {
+
+		protected Hashtable ht;
+		private static Random rnd;
+
+		public HTBasicOperationsTest (String name) : base(name)
+		{
+		}
+
+		protected override void SetUp ()
+		{
+			ht=new Hashtable ();
+			rnd=new Random ();
+		}
+
+		public static ITest Suite
+		{
+			get {
+				return new TestSuite (typeof(HTBasicOperationsTest));
+			}
+		}
+
+
+
+		private void SetDefaultData ()
+		{
+			ht.Clear ();
+			ht.Add ("k1","another");
+			ht.Add ("k2","yet");
+			ht.Add ("k3","hashtable");
+		}
+
+
+		public void TestAddRemoveClear ()
+		{
+			ht.Clear ();
+			Assert (ht.Count == 0);
+
+			SetDefaultData ();
+			Assert (ht.Count == 3);
+
+			bool thrown=false;
+			try {
+				ht.Add ("k2","cool");
+			} catch (ArgumentException) {thrown=true;}
+			Assert("Must throw ArgumentException!",thrown);
+
+			ht["k2"]="cool";
+			Assert(ht.Count == 3);
+			Assert(ht["k2"].Equals("cool"));
+
+		}
+
+		public void TestCopyTo ()
+		{
+			SetDefaultData ();
+			Object[] entries=new Object[ht.Count];
+			ht.CopyTo (entries,0);
+			Assert("Not an entry.",entries[0] is DictionaryEntry);
+		}
+
+
+		public void TestUnderHeavyLoad ()
+		{
+			Console.WriteLine ("Testing "+ht);
+			ht.Clear ();
+
+			int max=100000;
+			String[] cache=new String[max*2];
+			int n=0;
+
+			for (int i=0;i<max;i++) {
+				int id=rnd.Next()&0xFFFF;
+				String key=""+id+"-key-"+id;
+				String val="value-"+id;
+				if (ht[key]==null) {
+					ht[key]=val;
+					cache[n]=key;
+					cache[n+max]=val;
+					n++;
+				}
+			}
+
+			Assert(ht.Count==n);
+
+			for (int i=0;i<n;i++) {
+				String key=cache[i];
+				String val=ht[key] as String;
+				String err="ht[\""+key+"\"]=\""+val+
+				      "\", expected \""+cache[i+max]+"\"";
+				Assert(err,val!=null && val.Equals(cache[i+max]));
+			}
+
+			int r1=(n/3);
+			int r2=r1+(n/5);
+
+			for (int i=r1;i<r2;i++) {
+				ht.Remove(cache[i]);
+			}
+
+
+			for (int i=0;i<n;i++) {
+				if (i>=r1 && i<r2) {
+					Assert(ht[cache[i]]==null);
+				} else {
+					String key=cache[i];
+					String val=ht[key] as String;
+					String err="ht[\""+key+"\"]=\""+val+
+					      "\", expected \""+cache[i+max]+"\"";
+					Assert(err,val!=null && val.Equals(cache[i+max]));
+				}
+			}
+
+			ICollection keys=ht.Keys;
+			int nKeys=0;
+			foreach (Object key in keys) {
+				Assert((key as String) != null);
+				nKeys++;
+			}
+			Assert(nKeys==ht.Count);
+
+
+			ICollection vals=ht.Values;
+			int nVals=0;
+			foreach (Object val in vals) {
+				Assert((val as String) != null);
+				nVals++;
+			}
+			Assert(nVals==ht.Count);
+
+		}
+
+		/// <summary>
+		///  Test hashtable with CaseInsensitiveHashCodeProvider
+		///  and CaseInsensitive comparer.
+		/// </summary>
+		public void TestCaseInsensitive ()
+		{
+			// Not very meaningfull test, just to make
+			// sure that hcp is set properly set.
+			Hashtable ciHashtable = new Hashtable(11,1.0f,CaseInsensitiveHashCodeProvider.Default,CaseInsensitiveComparer.Default);
+			ciHashtable ["key1"] = "value";
+			ciHashtable ["key2"] = "VALUE";
+			Assert(ciHashtable ["key1"].Equals ("value"));
+			Assert(ciHashtable ["key2"].Equals ("VALUE"));
+
+			ciHashtable ["KEY1"] = "new_value";
+			Assert(ciHashtable ["key1"].Equals ("new_value"));
+
+		}
+
+
+		public void TestCopyConstructor ()
+		{
+			SetDefaultData ();
+
+			Hashtable htCopy = new Hashtable (ht);
+
+			Assert(ht.Count == htCopy.Count);
+		}
+
+
+		public void TestEnumerator ()
+		{
+			SetDefaultData ();
+
+			IEnumerator e = ht.GetEnumerator ();
+
+			while (e.MoveNext ()) {}
+
+			Assert (!e.MoveNext ());
+
+		}
+
+
+	}
+}

+ 128 - 0
mcs/class/corlib/Test/temp/MemoryStreamTest.cs

@@ -0,0 +1,128 @@
+//
+// System.IO.StringWriter
+//
+// Author: Marcin Szczepanski ([email protected])
+//
+// TODO: Add some testing for exceptions
+//
+// TODO: Add some testing for the CanXXX properties, exceptions,
+// various different constructors.
+//
+
+using NUnit.Framework;
+using System.IO;
+using System;
+using System.Text;
+
+public class MemoryStreamTest : TestCase {
+	
+        private MemoryStream testStream;
+        private byte[] testStreamData;
+        
+	public MemoryStreamTest( string name ): base(name) { }
+
+        protected override void SetUp() {
+                testStreamData = new byte[100];
+
+                for( int i = 0; i < 100; i++ ) {
+                        testStreamData[i] = (byte)(100 - i);
+                }
+
+                testStream = new MemoryStream( testStreamData );
+        }
+
+	public void TestConstructors() {
+                MemoryStream ms = new MemoryStream();
+
+                AssertEquals( 0, ms.Length );
+                AssertEquals( 0, ms.Capacity );
+                AssertEquals( true, ms.CanWrite );
+                
+                ms = new MemoryStream( 10 );
+
+                // FIXME: Should ms.Length be 0 if there is no data?
+                // the spec is a little unclear.  If this is changed then
+                // the code will probably need to change
+
+                AssertEquals( 10, ms.Length );
+                AssertEquals( 10, ms.Capacity );
+        }
+
+        // 
+        // Verify that the first count bytes in testBytes are the same as
+        // the count bytes from index start in testStreamData
+        //
+        private void VerifyTestData( byte[] testBytes, int start, int count) {
+                if( testBytes == null ) {
+                        throw new ArgumentNullException();
+                } else if( ( start < 0 || count < 0 ) || start + count > testStreamData.Length || start > testStreamData.Length ) {
+                        throw new ArgumentOutOfRangeException();
+                }
+
+                for( int test = 0; test < count; test++ ) {
+                        if( testBytes[ test ] != testStreamData[ start + test ] ) {
+                                string failStr = String.Format( "testByte {0} (testStream {1}) was <{2}>, expecting <{3}>", test, start+test, 
+                                        testBytes[ test ], testStreamData[ start+test] );
+                                Fail( failStr );
+                        }
+                }
+        }
+
+        public void TestRead() {
+                byte[] readBytes = new byte[20];
+
+                /* Test simple read */
+                testStream.Read( readBytes, 0, 10 );
+                VerifyTestData( readBytes, 0, 10 );
+
+                /* Seek back to beginning */
+
+                testStream.Seek( 0, SeekOrigin.Begin );
+ 
+                /* Read again, bit more this time */
+                testStream.Read( readBytes, 0, 20 );
+                VerifyTestData( readBytes, 0, 20 );
+
+                /* Seek to 20 bytes from End */
+                testStream.Seek( -20, SeekOrigin.End );
+                testStream.Read( readBytes, 0, 20);
+                VerifyTestData( readBytes, 80, 20);
+
+                int readByte = testStream.ReadByte();
+                AssertEquals( -1, readByte );
+                                      
+        }
+
+        public void TestWriteBytes() {
+                byte[] readBytes = new byte[100];
+                MemoryStream ms = new MemoryStream( 100 );
+
+                for( int i = 0; i < 100; i++ ) {
+                        ms.WriteByte( testStreamData[i] );
+                }
+
+                ms.Seek( 0, SeekOrigin.Begin); 
+                
+                testStream.Read( readBytes, 0, 100 );
+
+                VerifyTestData( readBytes, 0, 100 );
+        }               
+
+        public void TestWriteBlock() {
+                byte[] readBytes = new byte[100];
+                MemoryStream ms = new MemoryStream( 100 );
+
+                ms.Write( testStreamData, 0, 100 );
+
+                ms.Seek( 0, SeekOrigin.Begin); 
+                
+                testStream.Read( readBytes, 0, 100 );
+
+                VerifyTestData( readBytes, 0, 100 );
+
+                byte[] arrayBytes = testStream.ToArray();
+
+                VerifyTestData( arrayBytes, 0, 100 );
+
+        }
+}

+ 138 - 0
mcs/class/corlib/Test/temp/PathTest.cs

@@ -0,0 +1,138 @@
+//
+// System.IO.Path Test Cases
+//
+// Author: Marcin Szczepanski ([email protected])
+//
+// TODO: Add a more thorough workout for some
+// of the "trickier" functions.
+
+#define WINDOWS
+
+using NUnit.Framework;
+using System.IO;
+using System;
+using System.Text;
+
+public class PathTest : TestCase {
+
+        string path1;
+	string path2;
+        string path3;
+     
+
+	public PathTest( string name ): base(name) { }
+
+        protected override void SetUp() {
+                
+                #if WINDOWS
+                
+                path1 = "c:\\foo\\test.txt";
+                path2 = "c:\\winnt";
+                path3 = "system32";
+
+                #elif UNIX
+                
+                path1 = "/foo/test.txt";
+                path2 = "/etc";
+                path3 = "init.d"
+                
+                #elif MAC
+                
+                path1 = "foo:test.txt";
+                path2 = "foo";
+                path3 = "bar";
+
+                #endif
+
+        }
+
+
+        public void TestChangeExtension() {
+                string testPath = Path.ChangeExtension( path1, "doc" );
+
+                #if WINDOWS
+                AssertEquals( "c:\\foo\\test.doc", testPath );
+                #elif UNIX
+                AssertEquals( "/foo/test.doc", testPath );
+                #elif MAC
+                AssertEquals( "foo:test.doc", testPath );
+                #endif
+        }
+
+        public void TestCombine() {
+                string testPath = Path.Combine( path2, path3 );
+
+                #if WINDOWS
+                AssertEquals( "c:\\winnt\\system32", testPath );
+                #elif UNIX
+                AssertEquals( "/etc/init.d", testPath );
+                #elif MAC
+                AssertEquals( "foo:bar", testPath );
+                #endif
+        }
+
+        public void TestDirectoryName() {
+                string testDirName = Path.GetDirectoryName( path1 );
+
+                #if WINDOWS
+                AssertEquals( "c:\\foo", testDirName );
+                #elif UNIX
+                AssertEquals( "/etc", testDirName );
+                #elif MAC
+                AssertEquals( "foo", testDirName );
+                #endif
+        }
+
+        public void TestGetExtension() {
+                string testExtn = Path.GetExtension( path1 );
+
+                AssertEquals( ".txt", testExtn );
+
+                testExtn = Path.GetExtension( path2 );
+
+                AssertEquals ( "", testExtn );
+        }
+
+        public void TestGetFileName() {
+                string testFileName = Path.GetFileName( path1 );
+
+                AssertEquals( "test.txt", testFileName );
+        }
+
+        public void TestGetFileNameWithoutExtension() {
+                string testFileName = Path.GetFileNameWithoutExtension( path1 );
+
+                AssertEquals( "test", testFileName );
+        }
+
+        public void TestGetFullPath() {
+                string testFullPath = Path.GetFullPath( "foo.txt" );
+         //       AssertEquals( "foo.txt", testFullPath );
+        }
+        
+        public void TestGetTempPath() {
+                string getTempPath = Path.GetTempPath();
+                AssertEquals( Environment.GetEnvironmentVariable( "TEMP" ) + '\\',  getTempPath );
+        }
+
+        /*
+        // Not sure what's an appropriate test for this function?  Maybe just
+        // check if the temp file exists as advertised
+        //
+        public void TestGetTempFileName() {
+                string getTempFileName = Path.GetTempFileName();
+                //Console.WriteLine( getTempFileName );
+        }*/
+
+        public void TestHasExtension() {
+                AssertEquals( true, Path.HasExtension( "foo.txt" ) );
+                AssertEquals( false, Path.HasExtension( "foo" ) );
+                AssertEquals( true, Path.HasExtension( path1 ) );
+                AssertEquals( false, Path.HasExtension( path2 ) );
+        }
+
+        public void TestRooted() {
+                AssertEquals( true, Path.IsPathRooted( "c:\\winnt\\" ) );
+                AssertEquals( false, Path.IsPathRooted( "system32\\drivers\\" ) );
+        }
+}

+ 176 - 0
mcs/class/corlib/Test/temp/QueueTest.cs

@@ -0,0 +1,176 @@
+//
+// System.Collections.QueueTest
+// Test suite for System.Collections.Queue
+//
+// Author:
+//    Ricardo Fernández Pascual
+//
+// (C) 2001 Ricardo Fernández Pascual
+//
+
+
+
+using System;
+using System.Collections;
+using NUnit.Framework;
+
+namespace Testsuite.System.Collections {
+
+	public class QueueTest : TestCase {
+
+		public QueueTest () : base ("System.Collection.Queue testsuite") {}
+		public QueueTest (String name) : base (name) {}
+
+		protected Queue q1;
+		protected Queue q2;
+		protected Queue emptyQueue;
+
+		protected override void SetUp () {
+			q1 = new Queue (10);
+			for (int i = 0; i < 100; i++)
+				q1.Enqueue (i);
+			
+			q2 = new Queue (50, 1.5);
+			for (int i = 50; i < 100; i++)
+				q2.Enqueue (i);
+
+			emptyQueue = new Queue ();
+		}
+
+		public static ITest Suite {
+			get {
+				return new TestSuite (typeof (QueueTest));
+			}
+		}
+
+		public void TestConstructors () {
+			Assert (q1.Count == 100);
+			Assert (q2.Count == 50);
+			Assert (emptyQueue.Count = 0);
+			// TODO: Test Queue (ICollection)
+		}
+
+		// TODO: should test all methods from ICollection, 
+		// but it should be done in ICollectionTest.cs... ??
+
+		public void TestCopyTo () {
+			int[] a1 = new int[100];
+			int[] a2 = new int[60];
+
+			q1.CopyTo (a1, 0);
+			for (int i = 0; i < 100; i++)
+				AssertEquals (i, a1[i]);
+
+			// Remove some items from q2 and add other 
+			// items, to avoid having  an "easy" just created
+			// Queue
+			for (int i = 50; i < 60; i++)
+				Assert (i == (int) q2.Dequeue ());
+			for (int i = 100; i < 110; i++)
+				q2.Enqueue (i);
+			
+			q2.CopyTo (a2, 10);
+			for (int i = 60; i < 110; i++)
+				Assert (i == a2[i - 60 + 10]);
+			
+			// Copying an empty Queue should not modify the array
+			emptyQueue.CopyTo (a2, 10);
+			for (int i = 60; i < 110; i++)
+				Assert (i == a2[i - 60 + 10]);
+		}
+
+		public void TestEnumerator () {
+			int i;
+			IEnumerable e;
+			e = q1.GetEnumerator ();
+			i = 0;
+			while (e.MoveNext ()) {
+				Assert (e.Current () == i);
+				i++;
+			}
+			e = q2.GetEnumerator ();
+			i = 50;
+			while (e.MoveNext ()) {
+				Assert (e.Current () == i++);
+				i++;
+			}
+			e = emptyQueue.GetEnumerator ();
+			while (e.MoveNext ()) {
+				Fail ("Empty Queue enumarator returning elements!");
+			}
+			e = q1.GetEnumerator ();
+			try {
+				e.MoveNext ();
+				q1.Enqueue (0);
+				e.MoveNext ();
+				Fail ("Should have thrown InvalidOperationException");
+			} catch	(InvalidOperationException e) {}
+			e = q1.GetEnumerator ();
+			try {
+				e.MoveNext ();
+				q1.Enqueue (0);
+				object o = e.Current ();
+				Fail ("Should have thrown InvalidOperationException");
+			} catch	(InvalidOperationException e) {}
+		}
+
+		public void TestClone () {
+			Queue q3 = (Queue) q2.Clone ();
+			Assert (q3.Count == q2.Count);
+			for (int i = 0; i < 50; i++)
+				Assert (q2.Dequeue ().Equals (q3.Dequeue ()));
+			Assert (q3.Count == 0);
+			Assert (q2.Count == 0);
+		}
+
+		public void ClearTest () {
+			q1.Clear ();
+			Assert (q1.Count == 0);
+			q2.Clear ();
+			Assert (q2.Count == 0);
+			emptyQueue.Clear ();
+			Assert (emptyQueue.Count == 0);
+		}
+
+		public void ContainsTest () {
+			for (int i = 0; i < 100; i++) {
+				Assert (q1.Contains (i));
+				Assert (!emptyQueue.Contains (i));
+				if (i < 50)
+					Assert (!q2.Contains (i));
+				else
+					Assert (q2.Contains (i));
+			}
+		}
+		
+		public void EnqueueDequeuePeekTest () {
+			int q1size = q1.Count;
+			int q2size = q2.Count;
+			q2.Enqueue (null);
+			Assert (q2.Count = ++q2size);
+			for (int i = 0; i < 50; i++) {
+				int k = q1.Peek ();
+				Assert (q1.Count == q1size);
+				int j = q1.Dequeue ();
+				Assert (q1.Count == --q1size);
+				Assert (i == j);
+				Assert (j == k);
+				q2.Enqueue (j);
+				Assert (q2.Count == ++q2size);
+			}
+			for (int i = 50; i < 100; i++) {
+				Assert (((int) q2.Dequeue ()) == i);
+				Assert (q2.Count == --q2size);
+			}
+			Assert (q2.Peek () == null);
+			Assert (q2.Dequeue () == null);
+			Assert (q2.Count == --q2size);
+			for (int i = 0; i < 50; i++) {
+				Assert (((int) q2.Dequeue ()) == i);
+				Assert (q2.Count == --q2size);
+			}
+		}
+		
+		// TODO: test Syncronized operation
+	}
+}

+ 68 - 0
mcs/class/corlib/Test/temp/RandomTest.cs

@@ -0,0 +1,68 @@
+//
+// System.Random Test Cases
+//
+// Author: Bob Smith <[email protected]>
+//
+
+using NUnit.Framework;
+using System;
+
+public class RandomTest : TestCase
+{
+        public RandomTest(string name): base(name){}
+        public void TestDouble()
+        {
+                Random r = new Random();
+                int i;
+                double c=0;
+                for (i=0; i<20; i++) c+=r.NextDouble();
+                c/=i;
+                Assert (c < .7 && c > .3);
+        }
+        public void TestSeed()
+        {
+                Random r = new Random(42);
+                Random r2 = new Random(42);
+                int i;
+                double c=0, c2=0;
+                for (i=0; i<20; i++)
+                {
+                        c += r.NextDouble();
+                        c2 += r2.NextDouble();
+                }
+                AssertEquals(c, c2);
+        }
+        public void TestNext()
+        {
+                Random r = new Random();
+                int i;
+                long c;
+                for (i=0; i<20; i++)
+                {
+                        c = r.Next();
+                        Assert (c < Int32.MaxValue && c >= 0);
+                }
+        }
+        public void TestNextMax()
+        {
+                Random r = new Random();
+                int i;
+                long c;
+                for (i=0; i<20; i++)
+                {
+                        c = r.Next(10);
+                        Assert (c < 10 && c >= 0);
+                }
+        }
+        public void TestNextMinMax()
+        {
+                Random r = new Random();
+                int i;
+                long c;
+                for (i=0; i<20; i++)
+                {
+                        c = r.Next(1, 10);
+                        Assert (c < 10 && c >= 1);
+                }
+        }
+}

+ 47 - 0
mcs/class/corlib/Test/temp/ReadOnlyCollectionBaseTest.cs

@@ -0,0 +1,47 @@
+//
+// System.Collections.ReadOnlyCollectionBase
+// Test suite for System.Collections.ReadOnlyCollectionBase
+//
+// Author:
+//    Nick D. Drochak II
+//
+// (C) 2001 Nick D. Drochak II
+//
+
+
+using System;
+using System.Collections;
+using NUnit.Framework;
+
+	public class ReadOnlyCollectionBaseTest : TestCase 	{
+		public ReadOnlyCollectionBaseTest () : base ("System.Collection.ReadOnlyCollectionBase testsuite") {}
+		public ReadOnlyCollectionBaseTest (String name) : base (name) {}
+
+		// We need a concrete class to test the abstract base class
+		public class ConcreteReadOnlyCollection : ReadOnlyCollectionBase 
+		{
+		}
+
+		public static ITest Suite 
+		{
+			get {
+				return new TestSuite (typeof(ReadOnlyCollectionBaseTest));
+			}
+		}
+
+		// Make sure that the Count is 0 for a new object
+		public void TestZeroCountOnNew() 
+		{
+			ConcreteReadOnlyCollection myCollection;
+			myCollection = new ConcreteReadOnlyCollection();
+			Assert(0 == myCollection.Count);
+		}
+
+		// Make sure we get an object from GetEnumerator()
+		public void TestGetEnumerator() 
+		{
+			ConcreteReadOnlyCollection myCollection;
+			myCollection = new ConcreteReadOnlyCollection();
+			Assert(null != myCollection.GetEnumerator());
+		}
+	}

+ 353 - 0
mcs/class/corlib/Test/temp/StackFrameTest.cs

@@ -0,0 +1,353 @@
+//
+// Ximian.Mono.Tests.StackFrameTest.cs
+//
+// Author:
+//      Alexander Klyubin ([email protected])
+//
+// (C) 2001
+//
+
+using System;
+using System.Diagnostics;
+using System.Reflection;
+using NUnit.Framework;
+
+// FIXME: The class must be compiler with /debug in order for the tests to run
+// properly.
+
+namespace Ximian.Mono.Tests {
+        public class StackFrameTest {
+                private StackFrameTest() {}
+                public static ITest Suite 
+                { 
+                        get 
+                        {
+                                TestSuite suite =  new TestSuite();
+                                suite.AddTest(StackFrameTest1.Suite);
+                                suite.AddTest(StackFrameTest2.Suite);
+                                suite.AddTest(StackFrameTest3.Suite);
+                                return suite;
+                        }
+                }
+        }
+        
+        /// <summary>
+        ///   Tests the case where StackFrame is created for specified file name and
+        ///   location inside it.
+        /// </summary>
+        public class StackFrameTest1 : TestCase {
+                public StackFrameTest1(string name) : base(name) {}
+                
+                private StackFrame frame1;
+                private StackFrame frame2;
+                
+                internal static ITest Suite 
+                { 
+                        get 
+                        {
+                                return  new TestSuite(typeof(StackFrameTest1));
+                        }
+                }
+                
+                protected override void SetUp() {
+                        frame1 = new StackFrame("dir/someFile", 13, 45);
+                        frame2 = new StackFrame("SomeFile2.cs", 24);
+                }
+                
+                protected override void TearDown() {
+                        frame1 = null;
+                        frame2 = null;
+                }
+                
+                
+                
+                /// <summary>
+                ///   Tests whether getting file name works.
+                /// </summary>
+                public void TestGetFileName() {
+                        AssertEquals("File name (1)",
+                                     "dir/someFile",
+                                     frame1.GetFileName());
+                                     
+                        AssertEquals("File name (2)",
+                                     "SomeFile2.cs",
+                                     frame2.GetFileName());
+                }
+                
+                /// <summary>
+                ///   Tests whether getting file line number works.
+                /// </summary>
+                public void TestGetFileLineNumber() {
+                        AssertEquals("Line number (1)",
+                                     13,
+                                     frame1.GetFileLineNumber());
+                                     
+                        AssertEquals("Line number (2)",
+                                     24,
+                                     frame2.GetFileLineNumber());
+                }
+                
+                /// <summary>
+                ///   Tests whether getting file column number works.
+                /// </summary>
+                public void TestGetFileColumnNumber() {
+                        AssertEquals("Column number (1)",
+                                     45,
+                                     frame1.GetFileColumnNumber());
+                                     
+                        AssertEquals("Column number (2)",
+                                     0,
+                                     frame2.GetFileColumnNumber());
+                }
+                
+                                
+                /// <summary>
+                ///   Tests whether getting method associated with frame works.
+                /// </summary>
+                public void TestGetMethod() {
+                        Assert("Method not null (1)", (frame1.GetMethod() != null));
+
+                        AssertEquals("Class declaring the method (1)",
+                                     this.GetType(),
+                                     frame1.GetMethod().DeclaringType);
+                        AssertEquals("Method name (1)",
+                                     "SetUp",
+                                     frame1.GetMethod().Name);
+                                     
+                        Assert("Method not null (2)", (frame2.GetMethod() != null));
+                        
+                        AssertEquals("Class declaring the method (2)",
+                                     this.GetType(),
+                                     frame2.GetMethod().DeclaringType);
+                        AssertEquals("Method name (2)",
+                                     "SetUp",
+                                     frame2.GetMethod().Name);
+                }
+        }
+        
+        /// <summary>
+        ///   Tests the case where StackFrame is created for current method.
+        /// </summary>
+        /// <remarks>
+        ///   FIXME: Must be compiled with /debug switch. Otherwise some file
+        ///   information will be incorrect for the following test cases.
+        ///   What's the best way to do both types of tests with and without
+        ///   debug information?
+        /// </remarks>
+        public class StackFrameTest2 : TestCase {
+                public StackFrameTest2(string name) : base(name) {}
+                
+                private StackFrame frame1;
+                private StackFrame frame2;
+                private StackFrame frame3;
+                
+                internal static ITest Suite 
+                { 
+                        get 
+                        {
+                                return  new TestSuite(typeof(StackFrameTest2));
+                        }
+                }
+                
+                protected override void SetUp() {
+                        frame1 = new StackFrame();
+                        frame2 = new StackFrame(true);
+                        frame3 = new StackFrame(0);
+                }
+                
+                protected override void TearDown() {
+                        frame1 = null;
+                        frame2 = null;
+                        frame3 = null;
+                }
+                
+                
+                
+                /// <summary>
+                ///   Tests whether getting file name works.
+                /// </summary>
+                public void TestGetFileName() {
+                        AssertNull("File name (1)",
+                                   frame1.GetFileName());
+                                     
+                        Assert("File name (2) " + frame2.GetFileName()
+                                        + " ends with StackFrameTest.cs",
+                               frame2.GetFileName().EndsWith("StackFrameTest.cs"));
+                }
+                
+                /// <summary>
+                ///   Tests whether getting file line number works.
+                /// </summary>
+                public void TestGetFileLineNumber() {
+                        AssertEquals("Line number (1)",
+                                     0,
+                                     frame1.GetFileLineNumber());
+                                     
+                        AssertEquals("Line number (2)",
+                                     154,
+                                     frame2.GetFileLineNumber());
+                                     
+                        AssertEquals("Line number (3)",
+                                     0,
+                                     frame3.GetFileLineNumber());
+                }
+                
+                /// <summary>
+                ///   Tests whether getting file column number works.
+                /// </summary>
+                public void TestGetFileColumnNumber() {
+                        AssertEquals("Column number (1)",
+                                     0,
+                                     frame1.GetFileColumnNumber());
+                                     
+                        AssertEquals("Column number (2)",
+                                     25,
+                                     frame2.GetFileColumnNumber());
+                        
+                        AssertEquals("Column number (3)",
+                                     0,
+                                     frame3.GetFileColumnNumber());
+                }
+                
+                                
+                /// <summary>
+                ///   Tests whether getting method associated with frame works.
+                /// </summary>
+                public void TestGetMethod() {
+                        Assert("Method not null (1)",
+                               (frame1.GetMethod() != null));
+
+                        AssertEquals("Class declaring the method (1)",
+                                     this.GetType(),
+                                     frame1.GetMethod().DeclaringType);
+                        AssertEquals("Method name (1)",
+                                     "SetUp",
+                                     frame1.GetMethod().Name);
+                                     
+                        Assert("Method not null (2)",
+                               (frame2.GetMethod() != null));
+                        
+                        AssertEquals("Class declaring the method (2)",
+                                     this.GetType(),
+                                     frame2.GetMethod().DeclaringType);
+                        AssertEquals("Method name (2)",
+                                     "SetUp",
+                                     frame2.GetMethod().Name);
+                                     
+                        Assert("Method not null (3)",
+                               (frame3.GetMethod() != null));
+
+                        AssertEquals("Class declaring the method (3)",
+                                     this.GetType(),
+                                     frame3.GetMethod().DeclaringType);
+                        AssertEquals("Method name (3)",
+                                     "SetUp",
+                                     frame3.GetMethod().Name);
+                }
+        }
+        
+        
+        /// <summary>
+        ///   Tests the case where StackFrame is created for current method but
+        ///   skipping some frames.
+        /// </summary>
+        /// <remarks>
+        ///   FIXME: Must be compiled with /debug switch. Otherwise some file
+        ///   information will be incorrect for the following test cases.
+        ///   What's the best way to do both types of tests with and without
+        ///   debug information?
+        /// </remarks>
+        public class StackFrameTest3 : TestCase {
+                public StackFrameTest3(string name) : base(name) {}
+                
+                private StackFrame frame1;
+                private StackFrame frame2;
+                
+                internal static ITest Suite 
+                { 
+                        get 
+                        {
+                                return  new TestSuite(typeof(StackFrameTest3));
+                        }
+                }
+                
+                protected override void SetUp() {
+                        // In order to get better test cases with stack traces
+                        NestedSetUp();
+                }
+                
+                private void NestedSetUp() {
+                        frame1 = new StackFrame(2);
+                        frame2 = new StackFrame(1, true);
+                }
+                
+                protected override void TearDown() {
+                        frame1 = null;
+                        frame2 = null;
+                }
+                
+                
+                
+                /// <summary>
+                ///   Tests whether getting file name works.
+                /// </summary>
+                public void TestGetFileName() {
+                        AssertNull("File name (1)",
+                                   frame1.GetFileName());
+                                     
+                        Assert("File name (2) " + frame2.GetFileName()
+                                        + " ends with StackFrameTest.cs",
+                               frame2.GetFileName().EndsWith("StackFrameTest.cs"));
+                }
+                
+                /// <summary>
+                ///   Tests whether getting file line number works.
+                /// </summary>
+                public void TestGetFileLineNumber() {
+                        AssertEquals("Line number (1)",
+                                     0,
+                                     frame1.GetFileLineNumber());
+                                     
+                        AssertEquals("Line number (2)",
+                                     277,
+                                     frame2.GetFileLineNumber());
+                }
+                
+                /// <summary>
+                ///   Tests whether getting file column number works.
+                /// </summary>
+                public void TestGetFileColumnNumber() {
+                        AssertEquals("Column number (1)",
+                                     0,
+                                     frame1.GetFileColumnNumber());
+                                     
+                        AssertEquals("Column number (2)",
+                                     17,
+                                     frame2.GetFileColumnNumber());
+                }
+                
+                                
+                /// <summary>
+                ///   Tests whether getting method associated with frame works.
+                /// </summary>
+                public void TestGetMethod() {
+                        Assert("Method not null (1)", (frame1.GetMethod() != null));
+
+                        AssertEquals("Class declaring the method (1)",
+                                     typeof(NUnit.Framework.TestCase),
+                                     frame1.GetMethod().DeclaringType);
+                        AssertEquals("Method name (1)",
+                                     "RunBare",
+                                     frame1.GetMethod().Name);
+                                     
+                        Assert("Method not null (2)", (frame2.GetMethod() != null));
+                        
+                        AssertEquals("Class declaring the method (2)",
+                                     this.GetType(),
+                                     frame2.GetMethod().DeclaringType);
+                        AssertEquals("Method name (2)",
+                                     "SetUp",
+                                     frame2.GetMethod().Name);
+                }
+        }
+}

+ 275 - 0
mcs/class/corlib/Test/temp/StackTest.cs

@@ -0,0 +1,275 @@
+//
+// StackTest.cs
+//
+// Author:
+//  Chris Hynes <[email protected]>
+//
+// (C) 2001 Chris Hynes
+//
+
+using System;
+
+using System.Collections;
+
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests
+{
+	public class StackTest: TestCase
+	{
+                private Stack stack1;
+                private Stack stack2;
+                private Stack stackInt;
+
+                public void TestConstructor()
+                {
+                        AssertEquals(false, stack1 == null);
+                }
+                
+                public void TestICollectionConstructor()
+                {
+                        Stack stackTest = new Stack(new int[] {0, 1, 2, 3, 4});
+
+                        for (int i = 4; i >= 0; i--)
+                                AssertEquals(i, stackTest.Pop());
+
+                        AssertEquals(0, stackTest.Count);
+                }
+
+                public void TestIntConstructor()
+                {
+                        Stack stackTest = new Stack(50);
+
+                        AssertEquals(false, stackTest == null);
+                }
+
+                public void TestCount()
+                {
+                        Stack stackTest = new Stack();
+
+                        stackTest.Push(50);
+                        stackTest.Push(5);
+                        stackTest.Push(0);
+                        stackTest.Push(50);
+
+                        AssertEquals(4, stackTest.Count);
+                }
+
+                public void TestIsReadOnly()
+                {
+                        AssertEquals(false, stack1.IsReadOnly);
+                }
+
+                public void TestIsSyncronized()
+                {
+                        AssertEquals(false, stack1.IsSynchronized);
+                        AssertEquals(true, Stack.Synchronized(stack1).IsSynchronized);
+                }
+
+                public void TestSyncRoot()
+                {
+                        AssertEquals(false, stack1.SyncRoot == null);
+                }
+
+                public void TestGetEnumerator()
+                {
+                        stackInt.Pop();
+
+                        int j = 3;
+
+                        foreach (int i in stackInt)
+                        {
+                                AssertEquals(j--, i);
+                        }
+
+                        stackInt.Clear();
+
+                        IEnumerator e = stackInt.GetEnumerator();
+
+                        AssertEquals(false, e.MoveNext());
+                }
+
+                public void TestClear()
+                {
+                        stackInt.Clear();
+
+                        AssertEquals(0, stackInt.Count);
+                }
+
+                public void TestClone()
+                {
+                        Stack clone = (Stack)stackInt.Clone();
+
+                        while (stackInt.Count > 0)
+                        {
+                                AssertEquals(stackInt.Pop(), clone.Pop());
+                        }
+                }
+
+                public void TestContains()
+                {
+                        string toLocate = "test";
+
+                        stackInt.Push(toLocate);
+
+                        stackInt.Push("chaff");
+
+                        Assert(stackInt.Contains(toLocate));
+
+                        stackInt.Pop();
+
+                        Assert(stackInt.Contains(toLocate));
+
+                        stackInt.Pop();
+
+                        Assert(!stackInt.Contains(toLocate));
+                }
+
+                public void TestCopyTo()
+                {
+                        int[] arr = new int[stackInt.Count - 1];
+                        int[,] arrMulti;
+
+                        try 
+                        {
+                                stackInt.CopyTo(null, 0);
+                                Fail("Should throw an ArgumentNullException");
+                        } 
+                        catch (ArgumentNullException) {}
+
+                        try
+                        {
+                                stackInt.CopyTo(arr, -1);
+                                Fail("Should throw an ArgumentOutOfRangeException");
+                        } 
+                        catch (ArgumentOutOfRangeException) {}
+
+                        try
+                        {
+                                stackInt.CopyTo(arrMulti = new int[1, 1], 1);
+                                Fail("Should throw an ArgumentException");
+                        } 
+                        catch (ArgumentException) {}
+
+                        try
+                        {
+                                stackInt.CopyTo(arr = new int[2], 3);
+                                Fail("Should throw an ArgumentException");
+                        } 
+                        catch (ArgumentException) {}
+
+                        try
+                        {
+                                stackInt.CopyTo(arr = new int[3], 2);
+                                Fail("Should throw an ArgumentException");
+                        } 
+                        catch (ArgumentException) {}
+
+                        try
+                        {
+                                stackInt.CopyTo(arr = new int[2], 3);
+                                Fail("Should throw an ArgumentException");
+                        } 
+                        catch (ArgumentException) {}
+
+                        arr = new int[stackInt.Count];
+
+                        stackInt.CopyTo(arr, 0);
+
+                        int j = 4;
+
+                        for (int i = 0; i < 4; i++)
+                        {
+                               AssertEquals(j--, arr[i]);
+                        }
+                }
+
+                public void TestSyncronized()
+                {
+                        Stack syncStack = Stack.Synchronized(stackInt);
+
+                        syncStack.Push(5);
+
+                        for (int i = 5; i >= 0; i--)
+                                AssertEquals(i, syncStack.Pop());
+                }
+
+                public void TestPushPeekPop()
+                {
+                        stackInt.Pop();
+
+                        int topVal = (int)stackInt.Peek();
+
+                        AssertEquals(3, topVal);
+
+                        AssertEquals(4, stackInt.Count);
+
+                        AssertEquals(topVal, stackInt.Pop());
+
+                        AssertEquals(2, stackInt.Pop());
+
+                        Stack test = new Stack();
+                        test.Push(null);
+
+                        AssertEquals(null, test.Pop());
+                }
+
+                public void TestToArray()
+                {
+                        object[] arr = stackInt.ToArray();
+
+                        AssertEquals(stackInt.Count, arr.Length);                       
+
+                        for (int i = 0; i < 5; i++)
+                                AssertEquals(arr[i], stackInt.Pop());
+                }
+
+                static void Main(string[] args)
+		{
+      			//
+			// TODO: Add code to start application here
+			//
+		}
+
+                protected override void SetUp()
+                {
+                        stack1 = new Stack();
+                        stack2 = new Stack();
+
+                        stackInt = new Stack();
+    
+                        for (int i = 0; i < 5; i++)
+                                stackInt.Push(i);
+                }
+
+                public static ITest Suite 
+                { 
+                        get 
+                        {
+                                TestSuite stackSuite = new TestSuite(); 
+                                
+                                stackSuite.AddTest(new StackTest("TestConstructor"));
+                                stackSuite.AddTest(new StackTest("TestICollectionConstructor"));
+                                stackSuite.AddTest(new StackTest("TestIntConstructor"));
+
+                                stackSuite.AddTest(new StackTest("TestCount"));
+                                stackSuite.AddTest(new StackTest("TestIsReadOnly"));
+                                stackSuite.AddTest(new StackTest("TestIsSyncronized"));
+                                stackSuite.AddTest(new StackTest("TestSyncRoot"));
+
+                                stackSuite.AddTest(new StackTest("TestGetEnumerator"));
+                                stackSuite.AddTest(new StackTest("TestClear"));
+                                stackSuite.AddTest(new StackTest("TestClone"));
+                                stackSuite.AddTest(new StackTest("TestContains"));
+                                stackSuite.AddTest(new StackTest("TestPushPeekPop"));
+                                stackSuite.AddTest(new StackTest("TestCopyTo"));
+                                stackSuite.AddTest(new StackTest("TestSyncronized"));
+                                stackSuite.AddTest(new StackTest("TestToArray"));
+
+                                return stackSuite;
+                        }
+                }
+
+                public StackTest(string name): base(name) {}
+        }
+}

+ 98 - 0
mcs/class/corlib/Test/temp/StackTraceTest.cs

@@ -0,0 +1,98 @@
+//
+// Ximian.Mono.Tests.StackTraceTest.cs
+//
+// Author:
+//      Alexander Klyubin ([email protected])
+//
+// (C) 2001
+//
+
+using System;
+using System.Diagnostics;
+using System.Reflection;
+using NUnit.Framework;
+
+namespace Ximian.Mono.Tests {
+        public class StackTraceTest {
+                private StackTraceTest() {}
+                public static ITest Suite 
+                { 
+                        get 
+                        {
+                                TestSuite suite =  new TestSuite();
+                                suite.AddTest(StackTraceTest1.Suite);
+                                return suite;
+                        }
+                }
+        }
+        
+        /// <summary>
+        ///   Tests the case where StackTrace is created for specified
+        ///   stack frame.
+        /// </summary>
+        public class StackTraceTest1 : TestCase {
+                public StackTraceTest1(string name) : base(name) {}
+                
+                private StackTrace trace;
+                private StackFrame frame;
+                
+                internal static ITest Suite 
+                { 
+                        get 
+                        {
+                                return  new TestSuite(typeof(StackTraceTest1));
+                        }
+                }
+                
+                protected override void SetUp() {
+                        frame = new StackFrame("dir/someFile",
+                                               13,
+                                               45);
+                        trace = new StackTrace(frame);
+                }
+                
+                protected override void TearDown() {
+                        trace = null;
+                }
+                
+                
+                
+                /// <summary>
+                ///   Tests whether getting number of frames works.
+                /// </summary>
+                public void TestFrameCount() {
+                        AssertEquals("Frame count",
+                                     1,
+                                     trace.FrameCount);
+                }
+                
+                /// <summary>
+                ///   Tests whether getting frames by index which is out of
+                ///   range works.
+                /// </summary>
+                public void TestGetFrameOutOfRange() {
+                        Assert("Frame with index -1 == null",
+                               (trace.GetFrame(-1) == null));
+                        
+                        Assert("Frame with index -129 = null",
+                               (trace.GetFrame(-129) == null));
+                               
+                        Assert("Frame with index 1 = null",
+                               (trace.GetFrame(1) == null));
+                               
+                        Assert("Frame with index 145 = null",
+                               (trace.GetFrame(145) == null));
+
+                }
+        
+        
+                /// <summary>
+                ///   Tests whether getting frames by index works.
+                /// </summary>
+                public void TestGetFrame() {
+                        AssertEquals("Frame with index 0",
+                                     frame,
+                                     trace.GetFrame(0));
+                }                
+        }
+}

+ 107 - 0
mcs/class/corlib/Test/temp/StringBuilderTest.cs

@@ -0,0 +1,107 @@
+//
+// StringBuilderTest.dll - NUnit Test Cases for the System.Text.StringBuilder class
+// 
+// Author: Marcin Szczepanski ([email protected])
+//
+// NOTES: I've also run all these tests against the MS implementation of 
+// System.Text.StringBuilder to confirm that they return the same results
+// and they do.
+//
+// TODO: Add tests for the AppendFormat methods once the AppendFormat methods
+// are implemented in the StringBuilder class itself
+//
+// TODO: Potentially add more variations on Insert / Append tests for all the
+// possible types.  I don't really think that's necessary as they all
+// pretty much just do .ToString().ToCharArray() and then use the Append / Insert
+// CharArray function.  The ToString() bit for each type should be in the unit
+// tests for those types, and the unit test for ToCharArray should be in the 
+// string test type.  If someone wants to add those tests here for completness 
+// (and some double checking) then feel free :)
+//
+
+using NUnit.Framework;
+using System.Text;
+using System;
+
+public class StringBuilderTest : TestCase {
+
+        public StringBuilderTest( string name ) : base(name) { }
+
+        public void TestAppend() {
+                StringBuilder sb = new StringBuilder( "Foo" );
+                sb.Append( "Two" );
+                string expected = "FooTwo";
+                AssertEquals( expected, sb.ToString() );
+        }
+
+        public void TestInsert() {
+                StringBuilder sb = new StringBuilder();
+
+                AssertEquals( String.Empty, sb.ToString() ); 
+                        /* Test empty StringBuilder conforms to spec */
+
+                sb.Insert( 0, "Foo" ); /* Test insert at start of empty string */
+
+                AssertEquals( "Foo", sb.ToString() );
+
+                sb.Insert( 1, "!!" ); /* Test insert not at start of string */
+
+                AssertEquals( "F!!oo", sb.ToString() );
+
+                sb.Insert( 5, ".." ); /* Test insert at end of string */
+
+                AssertEquals( "F!!oo..", sb.ToString() );
+        
+                sb.Insert( 0, 1234 ); /* Test insert of a number (at start of string) */
+                
+                AssertEquals( "1234F!!oo..", sb.ToString() );
+                
+                sb.Insert( 5, 1.5 ); /* Test insert of a decimal (and end of string) */
+                
+                AssertEquals( "1234F1.5!!oo..", sb.ToString() );
+
+                sb.Insert( 4, 'A' ); /* Test char insert in middle of string */
+
+                AssertEquals( "1234AF1.5!!oo..", sb.ToString() );
+
+        }
+
+        public void TestReplace() {
+                StringBuilder sb = new StringBuilder( "Foobarbaz" );
+
+                sb.Replace( "bar", "!!!" );             /* Test same length replace in middle of string */
+                
+                AssertEquals( "Foo!!!baz", sb.ToString() );
+
+                sb.Replace( "Foo", "ABcD" );            /* Test longer replace at start of string */
+
+                AssertEquals( "ABcD!!!baz", sb.ToString() );
+
+                sb.Replace( "baz", "00" );              /* Test shorter replace at end of string */
+                        
+                AssertEquals( "ABcD!!!00", sb.ToString() );
+
+                sb.Replace( sb.ToString(), null );      /* Test string clear as in spec */
+
+                AssertEquals( String.Empty, sb.ToString() );
+
+                /*           |         10        20        30
+                /*         |0123456789012345678901234567890| */
+                sb.Append( "abc this is testing abc the abc abc partial replace abc" );
+
+                sb.Replace( "abc", "!!!", 0, 31 ); /* Partial replace at start of string */
+
+                AssertEquals( "!!! this is testing !!! the !!! abc partial replace abc", sb.ToString() );
+
+                sb.Replace( "testing", "", 0, 15 ); /* Test replace across boundary */
+
+                AssertEquals( "!!! this is testing !!! the !!! abc partial replace abc", sb.ToString() );
+
+                sb.Replace( "!!!", "" ); /* Test replace with empty string */
+
+                AssertEquals(" this is testing  the  abc partial replace abc", sb.ToString() );
+        }
+
+        public void TestAppendFormat() {
+        }
+}

+ 83 - 0
mcs/class/corlib/Test/temp/StringReaderTest.cs

@@ -0,0 +1,83 @@
+//
+// System.IO.StringWriter
+//
+// Author: Marcin Szczepanski ([email protected])
+//
+// TODO: Add some testing for exceptions
+//
+// TODO: Some of the tests could be a bit more thorough
+//
+
+using NUnit.Framework;
+using System.IO;
+using System;
+
+public class StringReaderTest : TestCase {
+	
+	public StringReaderTest( string name ): base(name) { }
+
+	public void TestPeekRead() {
+		StringReader reader = new StringReader( "Test String" );
+
+		int c = reader.Peek();
+		AssertEquals( c, 'T' );
+
+		int read = reader.Read();
+
+		AssertEquals( read, 'T' );
+		
+		c = reader.Peek();
+
+		AssertEquals( c, 'e' );
+	}
+
+	public void TestRead() {
+		StringReader reader = new StringReader( "Test String" );
+
+		/* Read from start of string */
+		char[] test = new char[5];
+		
+		int charsRead = reader.Read( test, 0, 5 );
+
+		AssertEquals( 5, charsRead );
+		AssertEquals( "Test ", new String(test)  );
+
+		/* Read to end of string */
+		//reader = new StringReader( "Test String" );
+		
+		test = new char[6];
+		charsRead = reader.Read( test, 0, 6 );
+		AssertEquals( 6, charsRead);
+		AssertEquals( "String", new String( test )  );
+
+		/* Read past end of string */
+
+		test = new char[6];
+		reader = new StringReader( "Foo" );
+		charsRead = reader.Read( test, 0, 6 );
+		AssertEquals( 3, charsRead );
+		AssertEquals(  "Foo\0\0\0", new String( test ) );
+
+	}
+
+        public void TestReadEOL() {
+                StringReader reader = new StringReader( "Line1\rLine2\r\nLine3\nLine4" );
+
+                string test = reader.ReadLine();
+
+                AssertEquals( "Line1", test );
+
+                test = reader.ReadLine();
+
+                AssertEquals( "Line2", test );
+
+                test = reader.ReadLine();
+
+                AssertEquals( "Line3", test );
+
+                test = reader.ReadLine();
+
+                AssertEquals( "Line4", test );
+        }
+}
+        

+ 45 - 0
mcs/class/corlib/Test/temp/StringWriterTest.cs

@@ -0,0 +1,45 @@
+//
+// System.IO.StringWriter
+//
+// Author: Marcin Szczepanski ([email protected])
+//
+// TODO: Add some testing for exceptions
+//
+
+using NUnit.Framework;
+using System.IO;
+using System;
+using System.Text;
+
+public class StringWriterTest : TestCase {
+	
+	public StringWriterTest( string name ): base(name) { }
+
+	public void TestConstructors() {
+                StringBuilder sb = new StringBuilder("Test String");
+
+                StringWriter writer = new StringWriter( sb );
+                AssertEquals( sb, writer.GetStringBuilder() );
+        }
+
+        public void TestWrite() {
+                StringWriter writer = new StringWriter();
+
+                AssertEquals( String.Empty, writer.ToString() );
+                
+                writer.Write( 'A' );
+                AssertEquals( "A", writer.ToString() );
+
+                writer.Write( " foo" );
+                AssertEquals( "A foo", writer.ToString() );
+
+                
+                char[] testBuffer = "Test String".ToCharArray();
+
+                writer.Write( testBuffer, 0, 4 );
+                AssertEquals( "A fooTest", writer.ToString() );
+
+                writer.Write( testBuffer, 5, 6 );
+                AssertEquals( "A fooTestString", writer.ToString() );
+        }
+}