[Mono-list] Newbie and ArrayList

Johannes Graumann johannes_graumann at web.de
Sun Apr 15 16:13:32 EDT 2007


On Sunday 15 April 2007 21:54, Alan McGovern wrote:
> Could you post up the entire test.cs file?
Sure. But beware, this is very much a work in progress and I am a bloody 
newbie ...

Thanks for your time!

Joh

using System;
using System.Collections;
using System.IO;
using NUnit.Framework;

namespace NUnitSyncJpgRaw
{
	
	[TestFixture()]
	public class Test
	{
		#region Establishment of Testing Infrastructure

			// The base path for the mock directory structure for testing					
			const string TestDir = "/tmp/somepath";
			
			// Construct the names needed for the mock directory structure
			ArrayList DSYears = new ArrayList();
			DSYears.Add(1);

			//			DSYears.Add('1901');
			//, "2004", "711", "1848", "1951", "1009");

			// A function to create the mock directory structure for testing 
			public void TestDirCreation(){
				if (Directory.Exists(TestDir)) {
					Directory.Delete(TestDir);
				}
				Directory.CreateDirectory(TestDir);		
			}
			
			// A function to delete the mock directory structure needed for testing 
			public void TestDirDeletion(){
				if (Directory.Exists(TestDir)) {
					Directory.Delete(TestDir);
				}
			}
			
		#endregion

		#region The actual Unit Tests
		
			[Test()]
			public void PrinterTest(){
				SyncJpgRaw.Printer printer = new SyncJpgRaw.Printer();
				Assert.AreSame("Hello World!", printer.Print());
			}
			
			// A unit test to evaluate whether file globbing performs as expected 
			[Test()]
			public void GlobbingTest(){
				TestDirCreation();
//				Console.WriteLine("Length: {0}",DSYears.Length);
				foreach (string y in DSYears){
					Console.WriteLine("{0}\n",y);
				}
			}
		
		#endregion
		
	}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-list/attachments/20070415/d461c41c/attachment.bin 


More information about the Mono-list mailing list