public void Fork_should_return_a_new_handle()
        {
            var subject = new ByteArrayChunk(1);

            var result = subject.Fork();

            result.Should().NotBeSameAs(subject);
            var subjectSegment = subject.Bytes;
            var resultSegment = result.Bytes;
            resultSegment.Array.Should().BeSameAs(subjectSegment.Array);
            resultSegment.Offset.Should().Be(subjectSegment.Offset);
            resultSegment.Count.Should().Be(subjectSegment.Count);
        }
        public void Fork_should_throw_when_subject_is_disposed()
        {
            var subject = new ByteArrayChunk(1);
            subject.Dispose();

            Action action = () => subject.Fork();

            action.ShouldThrow<ObjectDisposedException>().And.ObjectName.Should().Be("ByteArrayChunk");
        }
        public void Dispose_should_not_dispose_forked_handle()
        {
            var subject = new ByteArrayChunk(1);
            var forked = subject.Fork();

            subject.Dispose();

            var reflector = new Reflector((ByteArrayChunk)forked);
            reflector._disposed.Should().BeFalse();
        }