Ejemplo n.º 1
0
        public void DefaultConstructor()
        {
            using (var h = HGlobal.Create <int>())
            {
                Assert.AreEqual(sizeof(int), h.Length);
                Assert.NotNull(h.Data);

                Marshal.WriteInt32(h.Data, 100);
                Assert.AreEqual(100, h.Value);
            }
        }
Ejemplo n.º 2
0
        public void IntConstructor([Values(sizeof(int), sizeof(int) + 1)] int size)
        {
            using (var h = HGlobal.Create <int>(size))
            {
                Assert.AreEqual(size, h.Length);
                Assert.NotNull(h.Data);

                Marshal.WriteInt32(h.Data, 100);
                Assert.AreEqual(100, h.Value);
            }
        }
Ejemplo n.º 3
0
        public void IntConstructor()
        {
            using (var h = HGlobal.Create(sizeof(int)))
            {
                Assert.AreEqual(sizeof(int), h.Length);
                Assert.NotNull(h.Data);

                Marshal.WriteInt32(h.Data, 100);
                Assert.AreEqual(100, Marshal.ReadInt32(h.Data));
            }
        }
Ejemplo n.º 4
0
 public void IntConstructorSmallerSize()
 {
     Assert.Throws <ArgumentException>(() => HGlobal.Create <int>(sizeof(int) - 1));
 }