DatatypesLoadSaveTests SaveAndLoadRectangleManuallyWithBinaryWriterAndReader Method Delta Engine Documentation

Namespace: DeltaEngine.Tests.Datatypes
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void SaveAndLoadRectangleManuallyWithBinaryWriterAndReader()
Examples

[Test]
public void SaveAndLoadRectangleManuallyWithBinaryWriterAndReader()
{
    using (var dataStream = new MemoryStream())
    {
        var writer = new BinaryWriter(dataStream);
        var data = Rectangle.One;
        BinaryDataExtensions.Save(data, writer);
        dataStream.Seek(0, SeekOrigin.Begin);
        var reader = new BinaryReader(dataStream);
        data = (Rectangle)reader.Create();
        Assert.AreEqual(Rectangle.One, data);
    }
}
See Also