Beispiel #1
0
 internal static void AssertStringObject(ref string s, StringObject **strObj)
 {
     Debug.Assert((**strObj).MethodTable == Runtime.ReadMethodTable(ref s));
     Debug.Assert((**strObj).Header == Runtime.ReadObjHeader(ref s));
     Debug.Assert((**strObj).Length == s.Length);
     Debug.Assert((**strObj).FirstChar == s[0]);
 }
Beispiel #2
0
        public void Test()
        {
            object       x = "foo";
            HeapObject **h = Runtime.GetHeapObject(ref x);

            TestingAssertion.AssertHeapObject(ref x, h);

            string         s      = "foo";
            StringObject **strObj = Runtime.GetStringObject(ref s);

            TestingAssertion.AssertStringObject(ref s, strObj);

            int[]         arr    = { 1, 2, 3 };
            ArrayObject **arrObj = Runtime.GetArrayObject(ref arr);

            TestingAssertion.AssertArrayObject(ref arr, arrObj);

            s += " bar";
            Assert.That(s.Length, Is.EqualTo((**strObj).Length));
        }