コード例 #1
0
        public void Allocate_ValidSizeWorks()
        {
            //Act
            using (var target = SafeComMemoryHandle.Allocate(256))
            {
                var actual = target.Pointer;

                var written = WriteMemory(target.Pointer, 256);

                //Assert
                target.IsInvalid.Should().BeFalse();
                AssertMemory(target.Pointer, written);
            };
        }
コード例 #2
0
        public void Allocate_InvalidSizeFails()
        {
            Action action = () => SafeComMemoryHandle.Allocate(-5);

            action.ShouldThrowArgumentOutOfRangeException();
        }