Exemple #1
0
        public void OverwriteWithZeros_ShouldProduceDesiredResults_UsingFieldConstructor()
        {
            // Arrange.
            var length = 8;
            var field  = new Byte[length];

            using (var target = new PinnedBuffer(field, false))
            {
                // Arrange.
                target[0] = 0x01;
                target[2] = 0x01;
                target[4] = 0x01;
                target[6] = 0x01;

                // Assert.
                field[0].Should().Be(0x01);
                field[2].Should().Be(0x01);
                field[4].Should().Be(0x01);
                field[6].Should().Be(0x01);

                // Act.
                target.OverwriteWithZeros();

                // Assert.
                target.Should().OnlyContain(value => value == 0x00);
                field.Should().OnlyContain(value => value == 0x00);
            }
        }
Exemple #2
0
        public void OverwriteWithZeros_ShouldProduceDesiredResults_UsingLengthConstructor()
        {
            // Arrange.
            var length = 8;

            using (var target = new PinnedBuffer(length, false))
            {
                // Arrange.
                target[0] = 0x01;
                target[2] = 0x01;
                target[4] = 0x01;
                target[6] = 0x01;

                // Act.
                target.OverwriteWithZeros();

                // Assert.
                target.Should().OnlyContain(value => value == 0x00);
            }
        }