Example #1
0
        public void Dispose_NullPointerWorks()
        {
            //Act
            var target = new SafeComMemoryHandle();

            target.Dispose();

            //Assert - No real way to confirm the memory was released
            target.Pointer.Should().BeZero();
            target.IsInvalid.Should().BeTrue();
        }
Example #2
0
        public void Dispose_AttachedPointerWorks()
        {
            var ptr = AllocateMemory(10);

            //Act
            var target = new SafeComMemoryHandle();

            target.Attach(ptr);
            target.Dispose();

            //Assert - doesn't really confirm the memory was released
            target.Pointer.Should().BeZero();
            target.IsInvalid.Should().BeTrue();
        }