示例#1
0
        public void ShoudAllocate()
        {
            //arrange
            using var allocator = new DynamicAllocator(_logFactory);

            //act
            using var handle0 = allocator.TakeScoped(1024);
            using var handle1 = allocator.TakeScoped(1024);

            //assert
            handle0.Address.ShouldNotBe(IntPtr.Zero);
            handle0.IsValid.ShouldBe(true);

            handle1.Address.ShouldNotBe(IntPtr.Zero);
            handle1.IsValid.ShouldBe(true);

            allocator.Size.ShouldBe(2048u);
        }