Example #1
0
        public void StreamCanBeForkedButTheOriginalCannotBeRead()
        {
            VerifySupportsExceptionsInDelegates();

            var dotnet = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 });
            var stream = new SKManagedStream(dotnet, true);

            Assert.Equal(1, stream.ReadByte());
            Assert.Equal(2, stream.ReadByte());

            var dupe = stream.Fork();

            Assert.NotSame(stream, dupe);
            Assert.IsType <SKManagedStream>(dupe);
            Assert.Equal(3, dupe.ReadByte());
            Assert.Equal(4, dupe.ReadByte());
            Assert.Throws <InvalidOperationException>(() => stream.ReadByte());
        }