Esempio n. 1
0
        public void Utf8NotNullTest(string text)
        {
            IntPtr pointer = MarshalString.StringToUtf8(text);

            try
            {
                Assert.NotEqual(IntPtr.Zero, pointer);
            }
            finally
            {
                if (pointer != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(pointer);
                }
            }
        }
Esempio n. 2
0
        public void Utf8MarshalTest(string text)
        {
            IntPtr pointer = MarshalString.StringToUtf8(text);
            string marshalled;

            try
            {
                marshalled = MarshalString.Utf8ToString(pointer);
            }
            finally
            {
                if (pointer != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(pointer);
                }
            }
            Assert.Equal(text, marshalled);
        }
Esempio n. 3
0
 public void Utf8NullTest(string text)
 {
     Assert.Equal(IntPtr.Zero, MarshalString.StringToUtf8(text));
 }