[Mono-list] Bug in NUnit when initialising decimal

Krister Hansson ds99krha@thn.htu.se
Thu, 23 May 2002 07:29:04 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_0053_01C2022B.842D8460
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

> Krister,
>=20
> I don't get this on my Linux box, however the ConvertTest is causing =
NUnit
> some other kinds of problems.  See my post to Duncan.
>=20
> One thing Duncan helped me notice was that I am not using the GC with =
my
> mono (as far as I can tell). This might be a difference worth =
exploring.
>=20
> I'll see what I can track down at home tonight.
>=20
> Later,
> Nick D.

Hey Nick!

Made a little program that demonstrates the error. It is attached to =
this message. I got this when I ran it on win2k/cygwin.

$ mono ConvTest.exe
Errors   : 1
System.NullReferenceException
A null value was found where an object instance was =
requiredSystem.NullReference
Exceptionin (unmanaged) System.Type:get_method ()
in <0x00099> NUnit.Framework.TestCase:RunTest ()
in <0x0001c> NUnit.Framework.TestCase:RunBare ()
in <0x00010> .ProtectedProtect:Protect ()
in <0x00034> NUnit.Framework.TestResult:RunProtected =
(NUnit.Framework.ITest,NUni
t.Framework.IProtectable)

Failures : 0
RESULT: 0

This gives more info about the problem. Are you getting the same error =
message too??

/Krister


------=_NextPart_000_0053_01C2022B.842D8460
Content-Type: text/plain;
	name="DecInitTest.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="DecInitTest.cs"

using NUnit.Framework;
using System;
using System.Threading;
using System.Globalization;

public class DecimalInitiation : TestCase {
	public DecimalInitiation() : base( "DecimalInitiation" ) {}
	public DecimalInitiation(string name) : base(name) {}

	decimal tryDec;
	
	protected override void SetUp() {
		Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
		tryDec = 1234.2345m;
	}
	protected override void TearDown() {}
	public static ITest Suite {
		get { 
			return new TestSuite( typeof( DecimalInitiation ) ); 
		}
	}
	public void Test1() {
		AssertEquals("#A01", "hello", "hello");
		AssertEquals("#A02", "1234,2345", Convert.ToString(tryDec));
  }
}

public class Testing {
	public static void Main() {
		TestResult result = new TestResult();
		TestSuite suite = new TestSuite();

		suite.AddTest( DecimalInitiation.Suite );

		suite.Run( result );

		Console.WriteLine( "Errors   : " + result.ErrorCount );
		foreach( TestFailure f in result.Errors ) {
			Console.WriteLine( f.ThrownException );
		}

		Console.WriteLine( "Failures : " + result.FailureCount );
		foreach( TestFailure f in result.Failures ) {
			Console.WriteLine( f.ThrownException );
		}
	}
}

------=_NextPart_000_0053_01C2022B.842D8460--