[Mono-list] testcase for System.Convert complete...

Krister Hansson ds99krha@thn.htu.se
Thu, 16 May 2002 20:03:35 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_003B_01C1FD14.C33CA7B0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_003C_01C1FD14.C33E2E50"


------=_NextPart_001_003C_01C1FD14.C33E2E50
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Finally first testcase completed   :)
It is attached to this mail as ConvertTest.cs

Have had some problems with TestFromBase64CharArray and =
TestFromBase64String they both made an error about a unicode file. A =
file that generates that error is also attached to this message as =
test.cs

The test runs fine on Windows but I get these errors when using mono on =
Cygwin

AssertEquals("#H11", (decimal)23456.432, =
Convert.ToDecimal("23456,432"));
TestToDecimal(MonoTests.System.ConvertTest) "#H11 expected:<23456.432> =
but was:<23456432>"

AssertEquals("#I11", (double)23456.432, Convert.ToDouble("23456,432"));
TestToDouble(MonoTests.System.ConvertTest) "#I11 expected:<23456.432> =
but was:<23456432>"

It looks like there are some differences with how mono an mcs interprets =
'.' and ',' because when I change the string in one test like this

AssertEquals("#I11", (double)23456.432, Convert.ToDouble("23456.432")); =
//exchanged the ',' to '.'

and I get an format exception using csc but mono makes it a double with =
the correct value


Please get back to me with any types of complaints or comments on the =
test

regards

Krister

------=_NextPart_001_003C_01C1FD14.C33E2E50
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2715.400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff><FONT face=3DArial size=3D2><FONT size=3D2>
<DIV>Finally first testcase completed&nbsp;&nbsp; :)</DIV>
<DIV>It is attached to this mail as ConvertTest.cs</DIV>
<DIV>&nbsp;</DIV>
<DIV>Have had some problems with&nbsp;<FONT =
size=3D2>TestFromBase64CharArray and=20
<FONT size=3D2>TestFromBase64String they both made an error about a =
unicode file.=20
A file that generates that error is also attached to this message as=20
test.cs</FONT></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>The test runs fine on Windows but I get these errors when using =
mono on=20
Cygwin</DIV>
<DIV>&nbsp;</DIV>
<DIV></FONT></FONT><FONT face=3DArial size=3D2><FONT size=3D2><FONT=20
size=3D2>AssertEquals("#H11", (decimal</FONT><FONT size=3D2>)23456.432,=20
Convert.ToDecimal("23456,432"));</DIV></FONT>
<DIV>TestToDecimal(MonoTests.System.ConvertTest) "#H11=20
expected:&lt;23456.432&gt; but was:&lt;23456432&gt;"</DIV>
<DIV>&nbsp;</DIV><FONT size=3D2>
<DIV>AssertEquals("#I11", (double</FONT><FONT size=3D2>)23456.432,=20
Convert.ToDouble("23456,432"));</DIV></FONT>
<DIV>TestToDouble(MonoTests.System.ConvertTest) "#I11 =
expected:&lt;23456.432&gt;=20
but was:&lt;23456432&gt;"</DIV>
<DIV>&nbsp;</DIV>
<DIV>It looks like there are some&nbsp;differences with how mono an mcs=20
interprets '.' and ',' because when I change the string in one test like =

this</DIV>
<DIV>&nbsp;</DIV>
<DIV>AssertEquals("#I11", (double<FONT size=3D2>)23456.432,=20
Convert.ToDouble("23456.432")); //exchanged the ',' to '.'</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>and I get an format exception using csc but mono makes it a double =
with the=20
correct value</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Please get back to me with any types of complaints or comments on =
the=20
test</DIV>
<DIV>&nbsp;</DIV>
<DIV>regards</DIV>
<DIV>&nbsp;</DIV>
<DIV>Krister</DIV></FONT></FONT></BODY></HTML>

------=_NextPart_001_003C_01C1FD14.C33E2E50--

------=_NextPart_000_003B_01C1FD14.C33CA7B0
Content-Type: text/plain;
	name="ConvertTest.cs"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="ConvertTest.cs"

// TestConvert.cs - NUnit Test Cases for System.Convert class
//
// Krister Hansson (ds99krha@thn.htu.se)
// Andreas Jonsson (ds99anjn@thn.htu.se)
//=20
// (C) Krister Hansson & Andreas Jonsson
//=20


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

namespace MonoTests.System
{
	public class ConvertTest : TestCase
	{
		public ConvertTest() : base ("MonoTests.System.ConvertTest testsuite") =
{}
		public ConvertTest(string name) : base(name) {}

		bool boolTrue;
		bool boolFalse;
		byte tryByte;
		char tryChar;
		DateTime tryDT;
		decimal tryDec;
		double tryDbl;
		short tryInt16;
		int tryInt32;
		long tryInt64;
		object tryObj;
		sbyte trySByte;
		float tryFloat;
		string falseString;
		string trueString;
		string nullString;
		string tryStr;
		ushort tryUI16;
		uint tryUI32;
		ulong tryUI64;
		CultureInfo ci;
	=09
		protected override void SetUp() {
			boolTrue =3D true;
			boolFalse =3D false;
			tryByte =3D 0;
			tryChar =3D 'a';
			tryDT =3D new DateTime(2002,1,1);
			tryDec =3D 1234.2345m;
			tryDbl =3D 0;
			tryInt16 =3D 1234;
			tryInt32 =3D 12345;
			tryInt64 =3D 123456789012;
			tryObj =3D new Object();
			trySByte =3D 123;
			tryFloat =3D 1234.2345f;
			falseString =3D "false";
			trueString =3D "true";
			nullString =3D "null";
			tryStr =3D "foobar";
			tryUI16 =3D 34567;
			tryUI32 =3D 567891234;
			tryUI64 =3D 0;
			ci =3D new CultureInfo("sv-SE");
			ci.NumberFormat.NumberDecimalDigits =3D 3;
		}
		protected override void TearDown() {}

		public static ITest Suite {
			get {=20
				return new TestSuite(typeof(ConvertTest));=20
			}
		}

		public void TestChangeType() {
			AssertEquals("#A01", (short)12345, Convert.ChangeType(tryInt32, =
typeof(short)));
			AssertEquals("#A02", 'A', Convert.ChangeType(65, typeof(char)));
			AssertEquals("#A03", 66, Convert.ChangeType('B', typeof(int)));
			AssertEquals("#A04", ((ulong)12345), Convert.ChangeType(tryInt32, =
typeof(ulong)));
		=09
			AssertEquals("#A05", true, Convert.ChangeType(tryDec, =
TypeCode.Boolean));
			AssertEquals("#A06", 'f', Convert.ChangeType("f", TypeCode.Char));
			AssertEquals("#A07", (decimal)123456789012, =
Convert.ChangeType(tryInt64, TypeCode.Decimal));
			AssertEquals("#A08", (int)34567, Convert.ChangeType(tryUI16, =
TypeCode.Int32));

			AssertEquals("#A09", (double)567891234, Convert.ChangeType(tryUI32, =
typeof(double), ci));
			AssertEquals("#A10", (ushort)0, Convert.ChangeType(tryByte, =
typeof(ushort), ci));
			AssertEquals("#A11", (decimal)567891234, Convert.ChangeType(tryUI32, =
typeof(decimal), ci));
			AssertEquals("#A12", (float)1234, Convert.ChangeType(tryInt16, =
typeof(float), ci));
			AssertEquals("#A13", null, Convert.ChangeType(null, null, ci));

			AssertEquals("#A14", (decimal)0, Convert.ChangeType(tryByte, =
TypeCode.Decimal, ci));
			AssertEquals("#A15", "f", Convert.ChangeType('f', TypeCode.String, =
ci));
			AssertEquals("#A16", 'D', Convert.ChangeType(68, TypeCode.Char, ci));
			AssertEquals("#A17", (long)34567, Convert.ChangeType(tryUI16, =
TypeCode.Int64, ci));
			AssertEquals("#A18", null, Convert.ChangeType(null, TypeCode.Empty, =
ci));
		=09
			try {
				Convert.ChangeType(boolTrue, typeof(char));
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#A25", typeof(InvalidCastException), e.GetType());
			}
		=09
			try {
				Convert.ChangeType(tryChar, typeof(DateTime));
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#A26", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ChangeType(ci, TypeCode.String);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#A27", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ChangeType(tryInt32, null);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#A28", typeof(ArgumentNullException), e.GetType());
			}

			try=20
			{
				Convert.ChangeType(boolTrue, typeof(DateTime), ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#A29", typeof(InvalidCastException), e.GetType());
			}
		=09
			try {
				Convert.ChangeType(ci, typeof(DateTime), ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#A30", typeof(InvalidCastException), e.GetType());
			}

			/* Should throw ArgumentException but throws InvalidCastException
			try {
				Convert.ChangeType(tryUI32, typeof(FormatException), ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#A??", typeof(ArgumentException), e.GetType());
			}*/

			try {
				Convert.ChangeType(tryUI32, TypeCode.Byte, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#A31", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ChangeType(boolTrue, TypeCode.Char, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#A32", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ChangeType(boolTrue, null, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#A33", typeof(ArgumentNullException), e.GetType());
			}	=09
		}	=09

		public void TestGetTypeCode() {
			AssertEquals("#B01", TypeCode.String, Convert.GetTypeCode(tryStr));
			AssertEquals("#B02", TypeCode.UInt16, Convert.GetTypeCode(tryUI16));
			AssertEquals("#B03", TypeCode.UInt32, Convert.GetTypeCode(tryUI32));
			AssertEquals("#B04", TypeCode.UInt64, Convert.GetTypeCode(tryUI64));
			AssertEquals("#B05", TypeCode.Double, Convert.GetTypeCode(tryDbl));
			AssertEquals("#B06", TypeCode.Int16, Convert.GetTypeCode(tryInt16));
			AssertEquals("#B07", TypeCode.Int64, Convert.GetTypeCode(tryInt64));
			AssertEquals("#B08", TypeCode.Object, Convert.GetTypeCode(tryObj));
			AssertEquals("#B09", TypeCode.SByte, Convert.GetTypeCode(trySByte));
			AssertEquals("#B10", TypeCode.Single, Convert.GetTypeCode(tryFloat));
			AssertEquals("#B11", TypeCode.Byte, Convert.GetTypeCode(tryByte));
			AssertEquals("#B12", TypeCode.Char, Convert.GetTypeCode(tryChar));
			AssertEquals("#B13", TypeCode.DateTime, Convert.GetTypeCode(tryDT));
			AssertEquals("#B14", TypeCode.Decimal, Convert.GetTypeCode(tryDec));
			AssertEquals("#B15", TypeCode.Int32, Convert.GetTypeCode(tryInt32));
			AssertEquals("#B16", TypeCode.Boolean, =
Convert.GetTypeCode(boolTrue));
		}

		public void TestIsDBNull() {
			AssertEquals("#C01", false, Convert.IsDBNull(tryInt32));
			AssertEquals("#C02", true, Convert.IsDBNull(Convert.DBNull));
			AssertEquals("#C03", false, Convert.IsDBNull(boolTrue));
			AssertEquals("#C04", false, Convert.IsDBNull(tryChar));
			AssertEquals("#C05", false, Convert.IsDBNull(tryFloat));
		}
	=09
		public void TestToBoolean() {
			tryObj =3D (object)tryDbl;
		=09
			AssertEquals("#D01", true, Convert.ToBoolean(boolTrue));
			AssertEquals("#D02", false, Convert.ToBoolean(tryByte));
			AssertEquals("#D03", true, Convert.ToBoolean(tryDec));
			AssertEquals("#D04", false, Convert.ToBoolean(tryDbl));
			AssertEquals("#D05", true, Convert.ToBoolean(tryInt16));
			AssertEquals("#D06", true, Convert.ToBoolean(tryInt32));
			AssertEquals("#D07", true, Convert.ToBoolean(tryInt64));
			AssertEquals("#D08", false, Convert.ToBoolean(tryObj));
			AssertEquals("#D09", true, Convert.ToBoolean(trySByte));
			AssertEquals("#D10", true, Convert.ToBoolean(tryFloat));
			AssertEquals("#D11", true, Convert.ToBoolean(trueString));
			AssertEquals("#D12", false, Convert.ToBoolean(falseString));
			AssertEquals("#D13", true, Convert.ToBoolean(tryUI16));
			AssertEquals("#D14", true, Convert.ToBoolean(tryUI32));
			AssertEquals("#D15", false, Convert.ToBoolean(tryUI64));
			AssertEquals("#D16", false, Convert.ToBoolean(tryObj,ci));
			AssertEquals("#D17", true, Convert.ToBoolean(trueString, ci));
			AssertEquals("#D18", false, Convert.ToBoolean(falseString, ci));
		=09
			try {
				Convert.ToBoolean(tryChar);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#D20", typeof(InvalidCastException), e.GetType());
			}
		=09
			try {
				Convert.ToBoolean(tryDT);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#D21", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToBoolean(tryStr);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#D22", typeof(FormatException), e.GetType());
			}

			try {
				Convert.ToBoolean(nullString);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#D23", typeof(FormatException), e.GetType());
			}
		}

		public void TestToByte() {
		=09
			AssertEquals("#E01", (byte)1, Convert.ToByte(boolTrue));
			AssertEquals("#E02", (byte)0, Convert.ToByte(boolFalse));
			AssertEquals("#E03", tryByte, Convert.ToByte(tryByte));
			AssertEquals("#E04", (byte)114, Convert.ToByte('r'));
			AssertEquals("#E05", (byte)201, Convert.ToByte((decimal)200.6));
			AssertEquals("#E06", (byte)125, Convert.ToByte((double)125.4));
			AssertEquals("#E07", (byte)255, Convert.ToByte((short)255));
			AssertEquals("#E08", (byte)254, Convert.ToByte((int)254));
			AssertEquals("#E09", (byte)34, Convert.ToByte((long)34));
			AssertEquals("#E10", (byte)1, Convert.ToByte((object)boolTrue));
			AssertEquals("#E11", (byte)123, Convert.ToByte((float)123.49f));
			AssertEquals("#E12", (byte)57, Convert.ToByte("57"));
			AssertEquals("#E13", (byte)75, Convert.ToByte((ushort)75));
			AssertEquals("#E14", (byte)184, Convert.ToByte((uint)184));
			AssertEquals("#E15", (byte)241, Convert.ToByte((ulong)241));
			AssertEquals("#E16", (byte)123, Convert.ToByte(trySByte, ci));
			AssertEquals("#E17", (byte)27, Convert.ToByte("011011", 2));
			AssertEquals("#E18", (byte)13, Convert.ToByte("15", 8));
			AssertEquals("#E19", (byte)27, Convert.ToByte("27", 10));
			AssertEquals("#E20", (byte)250, Convert.ToByte("FA", 16));

			try {
				Convert.ToByte('\u03A9'); // sign of Omega on Win2k
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E25", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToByte(tryDT);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#D26", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToByte((decimal)22000);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E27", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToByte((double)255.5);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E28", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToByte(-tryInt16);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E29", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToByte((int)-256);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E30", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToByte(tryInt64);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E31", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToByte((object)ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E32", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToByte((sbyte)-1);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E33", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToByte((float)-0.6f);	=09
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E34", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToByte("1a1");	=09
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E35", typeof(FormatException), e.GetType());
			}

			try {
				Convert.ToByte("457");	=09
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E36", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToByte((ushort)30000);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E37", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToByte((uint)300);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E38", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToByte((ulong)987654321321);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E39", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToByte("10010111", 3);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E40", typeof(ArgumentException), e.GetType());
			}

			try {
				Convert.ToByte("3F3", 16);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#E41", typeof(OverflowException), e.GetType());
			}
		}

		public void TestToChar(){
			tryByte =3D 58;
			AssertEquals("#F01", ':', Convert.ToChar(tryByte));
			AssertEquals("#F02", 'a', Convert.ToChar(tryChar));
			AssertEquals("#F03", 'A', Convert.ToChar((short)65));
			AssertEquals("#F04", 'x', Convert.ToChar((int)120));
			AssertEquals("#F05", '"', Convert.ToChar((long)34));
			AssertEquals("#F06", '-', Convert.ToChar((sbyte)45));
			AssertEquals("#F07", '@', Convert.ToChar("@"));
			AssertEquals("#F08", 'K', Convert.ToChar((ushort)75));
			AssertEquals("#F09", '=3D', Convert.ToChar((uint)61));
			AssertEquals("#F10", '=C8', Convert.ToChar((ulong)200));
			AssertEquals("#F11", '{', Convert.ToChar((object)trySByte, ci));
			AssertEquals("#F12", 'o', Convert.ToChar(tryStr.Substring(1,1), ci));
		=09
			try {
				Convert.ToChar(boolTrue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F20", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToChar(tryDT);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F21", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToChar(tryDec);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F22", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToChar(tryDbl);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F23", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToChar((short)-1);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F24", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToChar(Int32.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F25", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToChar(Int32.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F26", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToChar(tryInt64);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F27", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToChar((long)-123);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F28", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToChar(ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F29", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToChar(-trySByte);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F30", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToChar(tryFloat);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F31", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToChar("foo");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F32", typeof(FormatException), e.GetType());
			}
		=09
			try {
				Convert.ToChar(null);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F33", typeof(ArgumentNullException), e.GetType());
			}

			try {
				Convert.ToChar(new Exception(), ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F34", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToChar(null, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F35", typeof(ArgumentNullException), e.GetType());
			}

			try {
				Convert.ToChar("", ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F36", typeof(FormatException), e.GetType());
			}

			try {
				Convert.ToChar(tryStr, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#F37", typeof(FormatException), e.GetType());
			}
		}

		public void TestToDateTime() {
			string dateString =3D "2002-01-01";
		=09
			AssertEquals("#G01", tryDT, Convert.ToDateTime(tryDT));
			AssertEquals("#G02", tryDT, Convert.ToDateTime(dateString));
			AssertEquals("#G03", tryDT, Convert.ToDateTime(dateString, ci));

			try {
				Convert.ToDateTime(boolTrue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G10", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDateTime(tryByte);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G11", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDateTime(tryChar);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G12", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDateTime(tryDec);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G13", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDateTime(tryDbl);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G14", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDateTime(tryInt16);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G15", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDateTime(tryInt32);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G16", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDateTime(tryInt64);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G17", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDateTime(ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G18", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDateTime(trySByte);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G19", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDateTime(tryFloat);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G20", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDateTime("20a2-01-01");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G21", typeof(FormatException), e.GetType());
			}

			try {
				Convert.ToDateTime("20002-25-01");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G22", typeof(ArgumentOutOfRangeException), =
e.GetType());
			}=20

			try {
				Convert.ToDateTime(tryUI16);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G23", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDateTime(tryUI32);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G24", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDateTime(tryUI64);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G25", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDateTime(ci, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G26", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDateTime("20a2-01-01", ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#G27", typeof(FormatException), e.GetType());
			}
		}

		public void TestToDecimal() {
			AssertEquals("#H01", (decimal)1, Convert.ToDecimal(boolTrue));
			AssertEquals("#H02", (decimal)0, Convert.ToDecimal(boolFalse));
			AssertEquals("#H03", (decimal)tryByte, Convert.ToDecimal(tryByte));
			AssertEquals("#H04", tryDec, Convert.ToDecimal(tryDec));
			AssertEquals("#H05", (decimal)tryDbl, Convert.ToDecimal(tryDbl));
			AssertEquals("#H06", (decimal)tryInt16, Convert.ToDecimal(tryInt16));
			AssertEquals("#H07", (decimal)tryInt32, Convert.ToDecimal(tryInt32));
			AssertEquals("#H08", (decimal)tryInt64, Convert.ToDecimal(tryInt64));
			AssertEquals("#H09", (decimal)trySByte, Convert.ToDecimal(trySByte));
			AssertEquals("#H10", (decimal)tryFloat, Convert.ToDecimal(tryFloat));
			AssertEquals("#H11", (decimal)23456.432, =
Convert.ToDecimal("23456,432"));
			AssertEquals("#H12", (decimal)tryUI16, Convert.ToDecimal(tryUI16));
			AssertEquals("#H13", (decimal)tryUI32, Convert.ToDecimal(tryUI32));
			AssertEquals("#H14", (decimal)tryUI64, Convert.ToDecimal(tryUI64));
			AssertEquals("#H15", (decimal)63784, Convert.ToDecimal("63784", ci));
		=09
			try {
				Convert.ToDecimal(tryChar);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#H20", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDecimal(tryDT);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#H21", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDecimal(double.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#H22", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToDecimal(double.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#H23", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToDecimal(ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#H24", typeof(InvalidCastException), e.GetType());
			}
		=09
			try {
				Convert.ToDecimal(tryStr);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#H25", typeof(FormatException), e.GetType());
			}
		=09
			try {
				string maxDec =3D decimal.MaxValue.ToString();
				maxDec =3D maxDec + "1";			=09
				Convert.ToDecimal(maxDec);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#H26", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToDecimal(ci, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#H27", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDecimal(tryStr, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#H28", typeof(FormatException), e.GetType());
			}
		=09
			try {
				string maxDec =3D decimal.MaxValue.ToString();
				maxDec =3D maxDec + "1";
				Convert.ToDecimal(maxDec, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#H29", typeof(OverflowException), e.GetType());
			}
		}
	=09
		public void TestToDouble() {
			AssertEquals("#I01", (double)1, Convert.ToDouble(boolTrue));
			AssertEquals("#I02", (double)0, Convert.ToDouble(boolFalse));
			AssertEquals("#I03", (double)tryByte, Convert.ToDouble(tryByte));
			AssertEquals("#I04", tryDbl, Convert.ToDouble(tryDbl));
			AssertEquals("#I05", (double)tryDec, Convert.ToDouble(tryDec));
			AssertEquals("#I06", (double)tryInt16, Convert.ToDouble(tryInt16));
			AssertEquals("#I07", (double)tryInt32, Convert.ToDouble(tryInt32));
			AssertEquals("#I08", (double)tryInt64, Convert.ToDouble(tryInt64));
			AssertEquals("#I09", (double)trySByte, Convert.ToDouble(trySByte));
			AssertEquals("#I10", (double)tryFloat, Convert.ToDouble(tryFloat));
			AssertEquals("#I11", (double)23456.432, =
Convert.ToDouble("23456,432"));
			AssertEquals("#I12", (double)tryUI16, Convert.ToDouble(tryUI16));
			AssertEquals("#I13", (double)tryUI32, Convert.ToDouble(tryUI32));
			AssertEquals("#I14", (double)tryUI64, Convert.ToDouble(tryUI64));
			AssertEquals("#H15", (double)63784, Convert.ToDouble("63784", ci));
		=09
			try {
				Convert.ToDouble(tryChar);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#I20", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDouble(tryDT);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#I21", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDouble(ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#I22", typeof(InvalidCastException), e.GetType());
			}
		=09
			try {
				Convert.ToDouble(tryStr);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#I23", typeof(FormatException), e.GetType());
			}
		=09
			try {
				string maxDec =3D double.MaxValue.ToString();
				maxDec =3D maxDec + "1";			=09
				Convert.ToDouble(maxDec);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#I24", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToDouble(ci, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#I25", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToDouble(tryStr, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#I26", typeof(FormatException), e.GetType());
			}
		=09
			try {
				string maxDec =3D double.MaxValue.ToString();
				maxDec =3D maxDec + "1";
				Convert.ToDouble(maxDec, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#I27", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToDouble(tryObj, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#I28", typeof(InvalidCastException), e.GetType());
			}
		}

		public void TestToInt16() {
			AssertEquals("#J01", (short)0, Convert.ToInt16(boolFalse));
			AssertEquals("#J02", (short)1, Convert.ToInt16(boolTrue));
			AssertEquals("#J03", (short)97, Convert.ToInt16(tryChar));
			AssertEquals("#J04", (short)1234, Convert.ToInt16(tryDec));
			AssertEquals("#J05", (short)0, Convert.ToInt16(tryDbl));
			AssertEquals("#J06", (short)1234, Convert.ToInt16(tryInt16));
			AssertEquals("#J07", (short)12345, Convert.ToInt16(tryInt32));
			AssertEquals("#J08", (short)30000, Convert.ToInt16((long)30000));
			AssertEquals("#J09", (short)123, Convert.ToInt16(trySByte));
			AssertEquals("#J10", (short)1234, Convert.ToInt16(tryFloat));
			AssertEquals("#J11", (short)578, Convert.ToInt16("578"));
			AssertEquals("#J12", (short)15500, Convert.ToInt16((ushort)15500));
			AssertEquals("#J13", (short)5489, Convert.ToInt16((uint)5489));
			AssertEquals("#J14", (short)9876, Convert.ToInt16((ulong)9876));
			AssertEquals("#J15", (short)14, Convert.ToInt16("14", ci));
			AssertEquals("#J16", (short)11, Convert.ToInt16("01011", 2));
			AssertEquals("#J17", (short)1540, Convert.ToInt16("3004", 8));
			AssertEquals("#J18", (short)321, Convert.ToInt16("321", 10));
			AssertEquals("#J19", (short)2748, Convert.ToInt16("ABC", 16));

			try {
				Convert.ToInt16(char.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J25", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt16(tryDT);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J26", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToInt16((decimal)(short.MaxValue + 1));
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J27", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt16((decimal)(short.MinValue - 1));
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J28", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt16((double)(short.MaxValue + 1));
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J29", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt16((double)(short.MinValue - 1));
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J30", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt16(50000);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J31", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt16(-50000);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J32", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt16(tryInt64);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J33", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt16(-tryInt64);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J34", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt16(tryObj);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J35", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToInt16((float)32767.5);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J36", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt16((float)-33000.54);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J37", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt16(tryStr);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J38", typeof(FormatException), e.GetType());
			}
		=09
			try {						=09
				Convert.ToInt16("-33000");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J39", typeof(OverflowException), e.GetType());
			}

			try {						=09
				Convert.ToInt16(ushort.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J40", typeof(OverflowException), e.GetType());
			}

			try {						=09
				Convert.ToInt16(uint.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J41", typeof(OverflowException), e.GetType());
			}

			try {						=09
				Convert.ToInt16(ulong.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J42", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt16(tryObj, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J43", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToInt16(tryStr, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J44", typeof(FormatException), e.GetType());
			}
		=09
			try {						=09
				Convert.ToInt16("-33000", ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J45", typeof(OverflowException), e.GetType());
			}

			try {						=09
				Convert.ToInt16("321", 11);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J46", typeof(ArgumentException), e.GetType());
			}

			try {						=09
				Convert.ToInt16("D8BF1", 16);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#J47", typeof(OverflowException), e.GetType());
			}
		}

		public void TestToInt32() {
			long tryMax =3D long.MaxValue;
			long tryMin =3D long.MinValue;
			AssertEquals("#K01", (int)0, Convert.ToInt32(boolFalse));
			AssertEquals("#K02", (int)1, Convert.ToInt32(boolTrue));
			AssertEquals("#K03", (int)0, Convert.ToInt32(tryByte));
			AssertEquals("#K04", (int)97, Convert.ToInt32(tryChar));
			AssertEquals("#K05", (int)1234, Convert.ToInt32(tryDec));
			AssertEquals("#K06", (int)0, Convert.ToInt32(tryDbl));
			AssertEquals("#K07", (int)1234, Convert.ToInt32(tryInt16));
			AssertEquals("#K08", (int)12345, Convert.ToInt32(tryInt32));
			AssertEquals("#K09", (int)60000, Convert.ToInt32((long)60000));
			AssertEquals("#K10", (int)123, Convert.ToInt32(trySByte));
			AssertEquals("#K11", (int)1234, Convert.ToInt32(tryFloat));
			AssertEquals("#K12", (int)9876, Convert.ToInt32((string)"9876"));
			AssertEquals("#K13", (int)34567, Convert.ToInt32(tryUI16));
			AssertEquals("#K14", (int)567891234, Convert.ToInt32(tryUI32));
			AssertEquals("#K15", (int)0, Convert.ToInt32(tryUI64));
			AssertEquals("#K16", (int)123, Convert.ToInt32("123", ci));
			AssertEquals("#K17", (int)128, Convert.ToInt32("10000000", 2));
			AssertEquals("#K18", (int)302, Convert.ToInt32("456", 8));
			AssertEquals("#K19", (int)456, Convert.ToInt32("456", 10));
			AssertEquals("#K20", (int)1110, Convert.ToInt32("456", 16));

			try {						=09
				Convert.ToInt32(tryDT);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K25", typeof(InvalidCastException), e.GetType());
			}

			try {			   =20
				Convert.ToInt32((decimal)tryMax);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K26", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt32((decimal)tryMin);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K27", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt32((double)tryMax);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K28", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt32((double)tryMin);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K29", typeof(OverflowException), e.GetType());
			}

			try {						=09
				Convert.ToInt32(tryInt64);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K30", typeof(OverflowException), e.GetType());
			}

			try {						=09
				Convert.ToInt32(-tryInt64);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K31", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt32(tryObj);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K32", typeof(InvalidCastException), e.GetType());
			}

			try {						=09
				Convert.ToInt32((float)tryMax);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K33", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt32((float)tryMin);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K34", typeof(OverflowException), e.GetType());
			}
		=09
			try {						=09
				Convert.ToInt32(tryStr, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K35", typeof(FormatException), e.GetType());
			}

			try {						=09
				Convert.ToInt32("-46565465123");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K36", typeof(OverflowException), e.GetType());
			}

			try {						=09
				Convert.ToInt32("46565465123");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K37", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt32((uint)tryMax);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K38", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt32((ulong)tryMax);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K39", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt32(tryObj, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K40", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToInt32(tryStr, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K41", typeof(FormatException), e.GetType());
			}

			try {
				Convert.ToInt32("-46565465123", ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K42", typeof(OverflowException), e.GetType());
			}
		=09
			try {
				Convert.ToInt32("654", 9);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#K43", typeof(ArgumentException), e.GetType());
			}
		}
		public void TestToInt64() {
			decimal longMax =3D long.MaxValue;
			longMax +=3D 1;
			decimal longMin =3D long.MinValue;
			longMin -=3D 1;

			AssertEquals("#L01", (long)0, Convert.ToInt64(boolFalse));
			AssertEquals("#L02", (long)1, Convert.ToInt64(boolTrue));
			AssertEquals("#L03", (long)97, Convert.ToInt64(tryChar));
			AssertEquals("#L04", (long)1234, Convert.ToInt64(tryDec));
			AssertEquals("#L05", (long)0, Convert.ToInt64(tryDbl));
			AssertEquals("#L06", (long)1234, Convert.ToInt64(tryInt16));
			AssertEquals("#L07", (long)12345, Convert.ToInt64(tryInt32));
			AssertEquals("#L08", (long)123456789012, Convert.ToInt64(tryInt64));
			AssertEquals("#L09", (long)123, Convert.ToInt64(trySByte));
			AssertEquals("#L10", (long)1234, Convert.ToInt64(tryFloat));
			AssertEquals("#L11", (long)564897, Convert.ToInt64("564897"));
			AssertEquals("#L12", (long)34567, Convert.ToInt64(tryUI16));
			AssertEquals("#L13", (long)567891234, Convert.ToInt64(tryUI32));
			AssertEquals("#L14", (long)0, Convert.ToInt64(tryUI64));
			AssertEquals("#L15", (long)-2548751, Convert.ToInt64("-2548751", =
ci));
			AssertEquals("#L16", (long)24987562, =
Convert.ToInt64("1011111010100011110101010", 2));
			AssertEquals("#L17", (long)-24578965, =
Convert.ToInt64("1777777777777642172153", 8));
			AssertEquals("#L18", (long)248759757, Convert.ToInt64("248759757", =
10));
			AssertEquals("#L19", (long)256, Convert.ToInt64("100", 16));

			try {
				Convert.ToInt64(tryDT);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#L25", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToInt64((decimal)longMax + 1);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#L23", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt64((decimal)longMin);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#L24", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt64((double)longMax);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#L25", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt64((double)longMin);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#L26", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt64(new Exception());
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#L27", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToInt64((float)longMax);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#L28", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt64((float)longMin);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#L29", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt64("-567b3");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#L30", typeof(FormatException), e.GetType());
			}

			try {
				Convert.ToInt64(longMax.ToString());
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#L31", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt64(ulong.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#L32", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToInt64(tryStr, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#L32", typeof(FormatException), e.GetType());
			}
		=09
			try {						=09
				Convert.ToInt64(longMin.ToString(), ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#L33", typeof(OverflowException), e.GetType());
			}

			try {						=09
				Convert.ToInt64("321", 11);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#L34", typeof(ArgumentException), e.GetType());
			}
		}

		public void TestToSByte() {
			AssertEquals("#M01", (sbyte)0, Convert.ToSByte(boolFalse));
			AssertEquals("#M02", (sbyte)1, Convert.ToSByte(boolTrue));
			AssertEquals("#M03", (sbyte)97, Convert.ToSByte(tryChar));
			AssertEquals("#M04", (sbyte)15, Convert.ToSByte((decimal)15));
			AssertEquals("#M05", (sbyte)0, Convert.ToSByte(tryDbl));
			AssertEquals("#M06", (sbyte)127, Convert.ToSByte((short)127));
			AssertEquals("#M07", (sbyte)-128, Convert.ToSByte((int)-128));
			AssertEquals("#M08", (sbyte)30, Convert.ToSByte((long)30));
			AssertEquals("#M09", (sbyte)123, Convert.ToSByte(trySByte));
			AssertEquals("#M10", (sbyte)12, Convert.ToSByte((float)12.46987f));
			AssertEquals("#M11", (sbyte)1, Convert.ToSByte("1"));
			AssertEquals("#M12", (sbyte)99, Convert.ToSByte((ushort)99));
			AssertEquals("#M13", (sbyte)54, Convert.ToSByte((uint)54));
			AssertEquals("#M14", (sbyte)127, Convert.ToSByte((ulong)127));
			AssertEquals("#M15", (sbyte)14, Convert.ToSByte("14", ci));
			AssertEquals("#M16", (sbyte)11, Convert.ToSByte("01011", 2));
			AssertEquals("#M17", (sbyte)5, Convert.ToSByte("5", 8));
			AssertEquals("#M18", (sbyte)100, Convert.ToSByte("100", 10));
			AssertEquals("#M19", (sbyte)-1, Convert.ToSByte("FF", 16));

			try {
				Convert.ToSByte((byte)200);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M25", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte((char)130);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M26", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte(tryDT);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M27", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToSByte((decimal)127.5m);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M28", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte((decimal)-200m);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M29", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte((double)150);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M30", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte((double)-128.6);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M31", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte((short)150);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M32", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte((short)-300);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M33", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte((int)1500);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M34", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte((int)-1286);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M35", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte((long)128);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M36", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte((long)-129);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M37", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte(new NumberFormatInfo());
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M38", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToSByte((float)333);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M39", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte((float)-666);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M40", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte("B3");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M41", typeof(FormatException), e.GetType());
			}

			try {
				Convert.ToSByte("251");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M42", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte(ushort.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M43", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte((uint)600);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M44", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte(ulong.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M45", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte(ci, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M46", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToSByte(tryStr, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M47", typeof(FormatException), e.GetType());
			}
		=09
			try {						=09
				Convert.ToSByte("325", ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M48", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSByte("5D", 15);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M49", typeof(ArgumentException), e.GetType());
			}
		=09
			try {						=09
				Convert.ToSByte("111111111", 2);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#M50", typeof(OverflowException), e.GetType());
			}
		}

		public void TestToSingle() {
			AssertEquals("#N01", (float)0, Convert.ToSingle(boolFalse));
			AssertEquals("#N02", (float)1, Convert.ToSingle(boolTrue));
			AssertEquals("#N03", (float)0, Convert.ToSingle(tryByte));
			AssertEquals("#N04", (float)1234,234, Convert.ToSingle(tryDec));
			AssertEquals("#N05", (float)0, Convert.ToSingle(tryDbl));
			AssertEquals("#N06", (float)1234, Convert.ToSingle(tryInt16));
			AssertEquals("#N07", (float)12345, Convert.ToSingle(tryInt32));
			AssertEquals("#N08", (float)123456789012, =
Convert.ToSingle(tryInt64));
			AssertEquals("#N09", (float)123, Convert.ToSingle(trySByte));
			AssertEquals("#N10", (float)1234,2345, Convert.ToSingle(tryFloat));
			AssertEquals("#N11", (float)987, Convert.ToSingle("987"));
			AssertEquals("#N12", (float)34567, Convert.ToSingle(tryUI16));
			AssertEquals("#N13", (float)567891234, Convert.ToSingle(tryUI32));
			AssertEquals("#N14", (float)0, Convert.ToSingle(tryUI64));
			AssertEquals("#N15", (float)654.234, Convert.ToSingle("654,234", =
ci));

			try {
				Convert.ToSingle(tryChar);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#N25", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToSingle(tryDT);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#N26", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToSingle(tryObj);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#N27", typeof(InvalidCastException), e.GetType());
			}
		=09
			try {
				Convert.ToSingle("A345H");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#N28", typeof(FormatException), e.GetType());
			}
		=09
			try {
				Convert.ToSingle(double.MaxValue.ToString());
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#N29", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToSingle(tryObj, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#N30", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToSingle("J345K", ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#N31", typeof(FormatException), e.GetType());
			}

			try {
				Convert.ToSingle("11000000000000000000000000000000000000000000000", =
ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#N32", typeof(OverflowException), e.GetType());
			}
		}

		public void TestToString() {
		=09
			tryByte =3D 123;
			AssertEquals("#O01", "False", Convert.ToString(boolFalse));
			AssertEquals("#O02", "True", Convert.ToString(boolTrue));
			AssertEquals("#O03", "123", Convert.ToString(tryByte));
			AssertEquals("#O04", "a", Convert.ToString(tryChar));
			AssertEquals("#O05", tryDT.ToString(), Convert.ToString(tryDT));
			AssertEquals("#O06", tryDec.ToString(), Convert.ToString(tryDec));
			AssertEquals("#O07", tryDbl.ToString(), Convert.ToString(tryDbl));
			AssertEquals("#O08", "1234", Convert.ToString(tryInt16));
			AssertEquals("#O09", "12345", Convert.ToString(tryInt32));
			AssertEquals("#O10", "123456789012", Convert.ToString(tryInt64));
			AssertEquals("#O11", "123", Convert.ToString(trySByte));
			AssertEquals("#O12", tryFloat.ToString(), =
Convert.ToString(tryFloat));
			AssertEquals("#O13", "foobar", Convert.ToString(tryStr));
			AssertEquals("#O14", "34567", Convert.ToString(tryUI16));
			AssertEquals("#O15", "567891234", Convert.ToString(tryUI32));
			AssertEquals("#O16", "True", Convert.ToString(boolTrue, ci));
			AssertEquals("#O17", "False", Convert.ToString(boolFalse, ci));
			AssertEquals("#O18", "123", Convert.ToString(tryByte, ci));
			AssertEquals("#O19", "1111011", Convert.ToString(tryByte, 2));
			AssertEquals("#O20", "173", Convert.ToString(tryByte, 8));
			AssertEquals("#O21", "123", Convert.ToString(tryByte, 10));
			AssertEquals("#O22", "7b", Convert.ToString(tryByte, 16));
			AssertEquals("#O23", "a", Convert.ToString(tryChar, ci));
			AssertEquals("#O24", tryDT.ToString(ci), Convert.ToString(tryDT, =
ci));
			AssertEquals("#O25", tryDec.ToString(ci), =
Convert.ToString(tryDec,ci));
			AssertEquals("#O26", tryDbl.ToString(ci), Convert.ToString(tryDbl, =
ci));
			AssertEquals("#O27", "1234", Convert.ToString(tryInt16, ci));
			AssertEquals("#O28", "10011010010", Convert.ToString(tryInt16, 2));
			AssertEquals("#O29", "2322", Convert.ToString(tryInt16, 8));
			AssertEquals("#O30", "1234", Convert.ToString(tryInt16, 10));
			AssertEquals("#O31", "4d2", Convert.ToString(tryInt16, 16));
			AssertEquals("#O32", "12345", Convert.ToString(tryInt32, ci));
			AssertEquals("#O33", "11000000111001", Convert.ToString(tryInt32, =
2));
			AssertEquals("#O34", "30071", Convert.ToString(tryInt32, 8));
			AssertEquals("#O35", "12345", Convert.ToString(tryInt32, 10));
			AssertEquals("#O36", "3039", Convert.ToString(tryInt32, 16));
			AssertEquals("#O37", "123456789012", Convert.ToString(tryInt64, ci));
			AssertEquals("#O38", "1110010111110100110010001101000010100",
				Convert.ToString(tryInt64, 2));
			AssertEquals("#O39", "1627646215024", Convert.ToString(tryInt64, 8));
			AssertEquals("#O40", "123456789012", Convert.ToString(tryInt64, 10));
			AssertEquals("#O41", "1cbe991a14", Convert.ToString(tryInt64, 16));
			AssertEquals("#O42", "123", Convert.ToString((trySByte), ci));
			AssertEquals("#O43", tryFloat.ToString(ci), =
Convert.ToString((tryFloat), ci));
			AssertEquals("#O44", "foobar", Convert.ToString((tryStr), ci));
			AssertEquals("#O45", "34567", Convert.ToString((tryUI16), ci));
			AssertEquals("#O46", "567891234", Convert.ToString((tryUI32), ci));
			AssertEquals("#O47", "0", Convert.ToString(tryUI64));
			AssertEquals("#O48", "0", Convert.ToString((tryUI64), ci));

			try {
				Convert.ToString(tryInt16, 5);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#O55", typeof(ArgumentException), e.GetType());
			}

			try {
				Convert.ToString(tryInt32, 17);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#O56", typeof(ArgumentException), e.GetType());
			}

			try {
				Convert.ToString(tryInt64, 1);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#O57", typeof(ArgumentException), e.GetType());
			}		=09
		}

        public void TestToUInt16() {
			AssertEquals("#P01", (ushort)0, Convert.ToUInt16(boolFalse));
			AssertEquals("#P02", (ushort)1, Convert.ToUInt16(boolTrue));
			AssertEquals("#P03", (ushort)0, Convert.ToUInt16(tryByte));
			AssertEquals("#P04", (ushort)97, Convert.ToUInt16(tryChar));
			AssertEquals("#P05", (ushort)1234, Convert.ToUInt16(tryDec));
			AssertEquals("#P06", (ushort)0, Convert.ToUInt16(tryDbl));
			AssertEquals("#P07", (ushort)1234, Convert.ToUInt16(tryInt16));
			AssertEquals("#P08", (ushort)12345, Convert.ToUInt16(tryInt32));
			AssertEquals("#P09", (ushort)43752, Convert.ToUInt16((long)43752));
			AssertEquals("#P10", (ushort)123, Convert.ToUInt16(trySByte));
			AssertEquals("#P11", (ushort)1234, Convert.ToUInt16(tryFloat));
			AssertEquals("#P12", (ushort)123, Convert.ToUInt16((string)"123"));
			AssertEquals("#P13", (ushort)34567, Convert.ToUInt16(tryUI16));
			AssertEquals("#P14", (ushort)56789, Convert.ToUInt16((uint)56789));
			AssertEquals("#P15", (ushort)0, Convert.ToUInt16(tryUI64));
			AssertEquals("#P16", (ushort)31, Convert.ToUInt16("31", ci));
			AssertEquals("#P17", (ushort)14, Convert.ToUInt16("1110", 2));
			AssertEquals("#P18", (ushort)32, Convert.ToUInt16("40", 8));
			AssertEquals("#P19", (ushort)40, Convert.ToUInt16("40", 10));
			AssertEquals("#P20", (ushort)64, Convert.ToUInt16("40", 16));


			try {
				Convert.ToUInt16(tryDT);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P25", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToUInt16(decimal.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P26", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16(decimal.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P27", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16(double.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P28", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16(double.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P29", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16(short.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P30", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16(int.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P31", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16(int.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P32", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16(long.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P33", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16(long.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P34", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16(tryObj);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P35", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToUInt16(sbyte.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P36", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16(float.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P37", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16(float.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P38", typeof(OverflowException), e.GetType());
			}
		=09
			try {
				Convert.ToUInt16("1A2");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P39", typeof(FormatException), e.GetType());
			}

			try {
				Convert.ToUInt16("-32800");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P40", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16(int.MaxValue.ToString());
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P41", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16(ulong.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P42", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16("1A2", ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P43", typeof(FormatException), e.GetType());
			}

			try {
				Convert.ToUInt16("-32800", ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P44", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16("456987", ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P45", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt16("40", 9);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#P46", typeof(ArgumentException), e.GetType());
			}
		}

		public void TestToUInt32() {
			AssertEquals("#Q01", (uint)1, Convert.ToUInt32(boolTrue));
			AssertEquals("#Q02", (uint)0, Convert.ToUInt32(boolFalse));
			AssertEquals("#Q03", (uint)0, Convert.ToUInt32(tryByte));
			AssertEquals("#Q04", (uint)97, Convert.ToUInt32(tryChar));
			AssertEquals("#Q05", (uint)1234, Convert.ToUInt32(tryDec));
			AssertEquals("#Q06", (uint)0, Convert.ToUInt32(tryDbl));
			AssertEquals("#Q07", (uint)1234, Convert.ToUInt32(tryInt16));
			AssertEquals("#Q08", (uint)12345, Convert.ToUInt32(tryInt32));
			AssertEquals("#Q09", (uint)1234567890, =
Convert.ToUInt32((long)1234567890));
			AssertEquals("#Q10", (uint)123, Convert.ToUInt32(trySByte));
			AssertEquals("#Q11", (uint)1234, Convert.ToUInt32(tryFloat));
			AssertEquals("#Q12", (uint)3456789, Convert.ToUInt32("3456789"));
			AssertEquals("#Q13", (uint)34567, Convert.ToUInt32(tryUI16));
			AssertEquals("#Q14", (uint)567891234, Convert.ToUInt32(tryUI32));
			AssertEquals("#Q15", (uint)0, Convert.ToUInt32(tryUI64));
			AssertEquals("#Q16", (uint)415, Convert.ToUInt32("110011111", 2));
			AssertEquals("#Q17", (uint)156, Convert.ToUInt32("234" ,8));
			AssertEquals("#Q18", (uint)234, Convert.ToUInt32("234" ,10));
			AssertEquals("#Q19", (uint)564, Convert.ToUInt32("234" ,16));
		=09

			try {
				Convert.ToUInt32(tryDT);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q25", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToUInt32(decimal.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q26", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt32((decimal)-150);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q27", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt32(double.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q28", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt32((double)-1);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q29", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt32(short.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q30", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt32(int.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q31", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt32(long.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q32", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt32((long)-50000);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q33", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt32(new Exception());
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q34", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToUInt32(sbyte.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q35", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt32(float.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q36", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt32(float.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q37", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt32("45t54");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q38", typeof(FormatException), e.GetType());
			}

			try {
				Convert.ToUInt32("-55");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q39", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt32(ulong.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q40", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt32(new Exception(), ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q41", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToUInt32(tryStr, ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q42", typeof(FormatException), e.GetType());
			}

			try {
				Convert.ToUInt32("-50", ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q43", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt32(decimal.MaxValue.ToString(), ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q44", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt32("1001110", 1);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#Q45", typeof(ArgumentException), e.GetType());
			}
		}

		public void TestToUInt64()=20
		{
			AssertEquals("#R01", (ulong)1, Convert.ToUInt64(boolTrue));
			AssertEquals("#R02", (ulong)0, Convert.ToUInt64(boolFalse));
			AssertEquals("#R03", (ulong)0, Convert.ToUInt64(tryByte));
			AssertEquals("#R04", (ulong)97, Convert.ToUInt64(tryChar));
			AssertEquals("#R05", (ulong)1234, Convert.ToUInt64(tryDec));
			AssertEquals("#R06", (ulong)0, Convert.ToUInt64(tryDbl));
			AssertEquals("#R07", (ulong)1234, Convert.ToUInt64(tryInt16));
			AssertEquals("#R08", (ulong)12345, Convert.ToUInt64(tryInt32));
			AssertEquals("#R09", (ulong)123456789012, =
Convert.ToUInt64(tryInt64));
			AssertEquals("#R10", (ulong)123, Convert.ToUInt64(trySByte));
			AssertEquals("#R11", (ulong)1234, Convert.ToUInt64(tryFloat));
			AssertEquals("#R12", (ulong)345678, Convert.ToUInt64("345678"));
			AssertEquals("#R13", (ulong)34567, Convert.ToUInt64(tryUI16));
			AssertEquals("#R14", (ulong)567891234, Convert.ToUInt64(tryUI32));
			AssertEquals("#R15", (ulong)0, Convert.ToUInt64(tryUI64));
			AssertEquals("#R16", (ulong)123, Convert.ToUInt64("123", ci));
			AssertEquals("#R17", (ulong)4, Convert.ToUInt64("100", 2));
			AssertEquals("#R18", (ulong)64, Convert.ToUInt64("100", 8));
			AssertEquals("#R19", (ulong)100, Convert.ToUInt64("100", 10));
			AssertEquals("#R20", (ulong)256, Convert.ToUInt64("100", 16));

			try {
				Convert.ToUInt64(tryDT);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R25", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToUInt64(decimal.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R26", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt64((decimal)-140);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R27", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt64(double.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R28", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt64((double)-1);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R29", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt64(short.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R30", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt64(int.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R31", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt64(long.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R32", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt64(tryObj);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R33", typeof(InvalidCastException), e.GetType());
			}

			try {
				Convert.ToUInt64(sbyte.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R34", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt64(float.MinValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R35", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt64(float.MaxValue);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R36", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt64("234rt78");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R37", typeof(FormatException), e.GetType());
			}

			try {
				Convert.ToUInt64("-68");
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R38", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt64(decimal.MaxValue.ToString());
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R39", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt64("23rd2", ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R40", typeof(FormatException), e.GetType());
			}

			try {
				Convert.ToUInt64(decimal.MinValue.ToString(), ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R41", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt64(decimal.MaxValue.ToString(), ci);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R42", typeof(OverflowException), e.GetType());
			}

			try {
				Convert.ToUInt64("132", 9);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#R43", typeof(ArgumentException), e.GetType());
			}
		}

		public void TestToBase64CharArray() {
			byte[] byteArr =3D {33, 127, 255, 109, 170, 54};
			//						   0    1    2    3    4    5    6    7
			char[] expectedCharArr =3D {'I', 'X', '/', '/', 'b', 'a', 'o', '2'};
			char[] result =3D new Char[8];
		=09
			Convert.ToBase64CharArray(byteArr, 0, byteArr.Length, result, 0);

			for (int i =3D 0; i < expectedCharArr.Length; i++) {
				AssertEquals("#S0" + i, expectedCharArr[i], result[i]);
			}

			try {
				Convert.ToBase64CharArray(null, 0, byteArr.Length, result, 0);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#S10", typeof(ArgumentNullException), e.GetType());
			}

			try {
				Convert.ToBase64CharArray(byteArr, -1, byteArr.Length, result, 0);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#S11", typeof(ArgumentOutOfRangeException), =
e.GetType());
			}

			try {
				Convert.ToBase64CharArray(byteArr, 0, -5, result, 0);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#S12", typeof(ArgumentOutOfRangeException), =
e.GetType());
			}

			try {
				Convert.ToBase64CharArray(byteArr, 0, byteArr.Length, result, -2);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#S13", typeof(ArgumentOutOfRangeException), =
e.GetType());
			}

			try {
				Convert.ToBase64CharArray(byteArr, 4, byteArr.Length, result, 0);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#S14", typeof(ArgumentOutOfRangeException), =
e.GetType());
			}

			try {
				Convert.ToBase64CharArray(byteArr, 0, byteArr.Length, result, 2);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#S15", typeof(ArgumentOutOfRangeException), =
e.GetType());
			}
		}	=09
		public void TestToBase64String() {
			byte[] byteArr =3D {33, 127, 255, 109, 170, 54};
			string expectedStr =3D "IX//bao2";
			string result1;
			string result2;
		=09
			result1 =3D Convert.ToBase64String(byteArr);
			result2 =3D Convert.ToBase64String(byteArr, 0, byteArr.Length);

			AssertEquals("#T01", expectedStr, result1);
			AssertEquals("#T02", expectedStr, result2);

			try {
				Convert.ToBase64String(null);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#T05", typeof(ArgumentNullException), e.GetType());
			}
		=09
			try {
				Convert.ToBase64String(byteArr, -1, byteArr.Length);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#T06", typeof(ArgumentOutOfRangeException), =
e.GetType());
			}

			try {
				Convert.ToBase64String(byteArr, 0, -10);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#T07", typeof(ArgumentOutOfRangeException), =
e.GetType());
			}

			try {
				Convert.ToBase64String(byteArr, 4, byteArr.Length);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#T08", typeof(ArgumentOutOfRangeException), =
e.GetType());
			}	=09
		}

		/* Have experienced some problems with FromBase64CharArray using mono. =
Something=20
		 * about error in a unicode file.
		 *
		 * However the test seems to run fine using mono in a cygwin =
environment
		 */
		public void TestFromBase64CharArray() {

			char[] charArr =3D {'M','o','n','o','m','o','n','o'};
			byte[] expectedByteArr =3D {50, 137, 232, 154, 137, 232};
		=09
			byte[] fromCharArr =3D Convert.FromBase64CharArray(charArr, 0, 8);		=09

			for (int i =3D 0; i < fromCharArr.Length; i++){
				AssertEquals("#U0" + i, expectedByteArr[i], fromCharArr[i]);
			}

			try {
				Convert.FromBase64CharArray(null, 0, charArr.Length);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#U10", typeof(ArgumentNullException), e.GetType());
			}
		=09
			try {
				Convert.FromBase64CharArray(charArr, -1, charArr.Length);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#U11", typeof(ArgumentOutOfRangeException), =
e.GetType());
			}

			try {
				Convert.FromBase64CharArray(charArr, 0, -5);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#U12", typeof(ArgumentOutOfRangeException), =
e.GetType());
			}

			try {
				Convert.FromBase64CharArray(charArr, 0, 3);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#U13", typeof(FormatException), e.GetType());
			}

			try {
				Convert.FromBase64CharArray(charArr, 0, 9);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#U14", typeof(ArgumentOutOfRangeException), =
e.GetType());
			}

			try {
				Convert.FromBase64CharArray(charArr, 0, 5);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#U15", typeof(FormatException), e.GetType());
			}
		}

		/* Have experienced some problems with FromBase64String using mono. =
Something about=20
		 * error in a unicode file.
		 *
		 * However the test seems to run fine using mono in a cygwin =
environment
		 */
		public void TestFromBase64String() {
			string str =3D "Monomono";
			string err01 =3D "foo";

			byte[] expectedByteArr =3D {50, 137, 232, 154, 137, 232};
			byte[] fromStr =3D Convert.FromBase64String(str);=09

			for (int i =3D 0; i < fromStr.Length; i++){
				AssertEquals("#V0" + i, expectedByteArr[i], fromStr[i]);
			}

			try {
				Convert.FromBase64String(null);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#V10", typeof(ArgumentNullException), e.GetType());
			}

			try {
				Convert.FromBase64String(err01);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#V11", typeof(FormatException), e.GetType());
			}

			try {
				Convert.FromBase64String(tryStr);
				Fail();
			}
			catch (Exception e) {
				AssertEquals("#V12", typeof(FormatException), e.GetType());
			}
		}
	}
}
------=_NextPart_000_003B_01C1FD14.C33CA7B0
Content-Type: text/plain;
	name="test.cs"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="test.cs"

using System;
using System.Globalization;

namespace ConsoleApplication2
{
	public class testing
	{	
		public void testFrom64()
		{
			char[] charArr = {'a','s','d','f'};
			string str = "rlp7QA==";
			
			byte[] fromCharArr = Convert.FromBase64CharArray(charArr, 0, 4);
			byte[] fromStr = Convert.FromBase64String(str);			

			for(int i = 0; i < fromCharArr.GetLength(0); i++)
				Console.Write((char)fromCharArr[i]+" ");
			Console.WriteLine();

			for(int i = 0; i < fromStr.GetLength(0); i++) 
				Console.Write(fromStr[i]+" ");
			Console.WriteLine();
		}

	}	

	public class kribbe
	{
		public static void Main(string[] args)
		{
			testing t = new testing();
			t.testFrom64();
			Console.ReadLine();
		}

	}
}

------=_NextPart_000_003B_01C1FD14.C33CA7B0--