コード例 #1
0
        public void SerializationHorizontal()
        {
            var layout = _layoutFactory.Build(MonitorWidth, MonitorHeight, BezelHeight);

            var stream = new MemoryStream();

            _layoutFactory.Serialize(layout, stream);
            stream.Position = 0;
            var reader = new StreamReader(stream);
            var text   = reader.ReadToEnd();

            var target = Encoding.UTF8.GetString(Resources.horizontal);

            StripControlChars(text).Should().Be(StripControlChars(target));
        }
コード例 #2
0
        public void SerializationHorizontal()
        {
            var layout = _layoutFactory.Build(MonitorWidth, MonitorHeight, BezelHeight);

            var stream = new MemoryStream();

            _layoutFactory.Serialize(layout, stream);
            stream.Position = 0;

            // Sanity check that the expected XML deserializes to the same object
            var target = _serializer.Deserialize(new MemoryStream(Resources.horizontal));

            layout.Should().BeEquivalentTo(target);

            // Verify the layout serialization
            var source = _serializer.Deserialize(stream);

            source.Should().BeEquivalentTo(target);
        }