public void EnsureInputStreamIsNotDisposed()
        {
            var orig = new ModelContainingAStream
            {
                Stream = new MemoryStream(new byte[] { 1, 2, 3, 4, 5 })
            };

            JsonConvert.SerializeObject(orig, _settings);


            orig.Stream.CanRead.Should().BeTrue();
            orig.Stream.CanWrite.Should().BeTrue();
        }
        public void RoundtripContent(byte[] origStreamContent)
        {
            // Setup input...
            var orig = new ModelContainingAStream
            {
                Stream = origStreamContent == null
                    ? null
                    : new MemoryStream(origStreamContent)
            };

            // Serialize...
            var json = JsonConvert.SerializeObject(orig, _settings);

            // Deserialize...
            var result = JsonConvert.DeserializeObject <ModelContainingAStream>(json, _settings);

            // Check...
            var resultStreamContent = StreamExtensions.CopyToArray(result.Stream);

            Assert.Equal(origStreamContent, resultStreamContent);
        }