--- /dev/null
+// Testsuite.System.AllSystemTests.cs
+//
+// Mario Martinez (mariom925@home.om)
+//
+// (C) Ximian, Inc. http://www.ximian.com
+//
+
+using System;
+using NUnit.Framework;
+
+namespace MonoTests.System.Runtime.CompilerServices {
+ /// <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(RuntimeHelpersTest.Suite);
+ return suite;
+ }
+ }
+ }
+}
+
--- /dev/null
+//\r
+// RuntimeHelpersTest.cs - NUnit Test Cases for the System.Runtime.CompilerServices.RuntimeHelpers class\r
+//\r
+// Zoltan Varga (vargaz@freemail.hu)\r
+//\r
+// (C) Ximian, Inc. http://www.ximian.com\r
+\r
+using System;\r
+using System.Runtime.CompilerServices;\r
+\r
+using NUnit.Framework;\r
+\r
+namespace MonoTests.System.Runtime.CompilerServices {\r
+\r
+ public class RuntimeHelpersTest : TestCase {\r
+ struct FooStruct {\r
+ public int i;\r
+ public string j;\r
+ }\r
+\r
+ class FooClass {\r
+ public static int counter = 0;\r
+\r
+ static FooClass () {\r
+ counter = counter + 1;\r
+ }\r
+ }\r
+\r
+ public RuntimeHelpersTest () : base ("MonoTests.System.Runtime.CompilerServices.RuntimeHelpers testcase") {}\r
+\r
+ public RuntimeHelpersTest (String name) : base (name) {}\r
+ \r
+ protected override void SetUp ()\r
+ {\r
+ }\r
+\r
+ public static ITest Suite\r
+ {\r
+ get {\r
+ return new TestSuite(typeof(RuntimeHelpersTest));\r
+ }\r
+ }\r
+\r
+ public void TestOffsetToStringData () \r
+ {\r
+ AssertEquals ("OffsetToStringData is not constant",\r
+ RuntimeHelpers.OffsetToStringData,\r
+ RuntimeHelpers.OffsetToStringData);\r
+ }\r
+\r
+ public void TestGetObjectValue ()\r
+ {\r
+ FooStruct s1;\r
+ FooStruct s2;\r
+\r
+ // Test null\r
+ AssertEquals ("",\r
+ RuntimeHelpers.GetObjectValue (null),\r
+ null);\r
+ \r
+ // Test non-valuetype\r
+ AssertEquals ("",\r
+ RuntimeHelpers.GetObjectValue (this),\r
+ this);\r
+\r
+ // Test valuetype\r
+ s1.i = 42;\r
+ s1.j = "FOO";\r
+ s2 = (FooStruct)RuntimeHelpers.GetObjectValue(s1);\r
+ s1.i = 43;\r
+ s1.j = "BAR";\r
+ AssertEquals ("", s2.i, 42);\r
+ AssertEquals ("", s2.j, "FOO");\r
+ }\r
+\r
+ public void TestRunClassConstructor ()\r
+ {\r
+ RuntimeHelpers.RunClassConstructor (typeof(FooClass).TypeHandle);\r
+ AssertEquals ("", FooClass.counter, 1);\r
+\r
+ // Each static constructor should only be run once\r
+ RuntimeHelpers.RunClassConstructor (typeof(FooClass).TypeHandle);\r
+ AssertEquals ("", FooClass.counter, 1);\r
+ }\r
+ }\r
+}\r