Hi,
The problem is you're trying to call a method (arraylist.Add()) inside the
class itself. You can't do that. You can only call the method from inside a
constructor or another method.
Since you're writing NUnit tests, you could create a method and mark it with
[TestFixtureSetup]. Inside that method you can call arrayList.Add(1); and
everything will be ok.
Alan.
On 4/15/07, Johannes Graumann <[EMAIL PROTECTED]> wrote:
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
}
}
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list