Triangle2DTests SaveAndLoad Method Delta Engine Documentation

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

public void SaveAndLoad()
Examples

[Test]
public void SaveAndLoad()
{
    var data = BinaryDataExtensions.SaveToMemoryStream(Triangle2D.Zero);
    byte[] savedBytes = data.ToArray();
    Assert.AreEqual(1 + 4 + "Triangle2D".Length + Triangle2D.SizeInBytes, savedBytes.Length);
    Assert.AreEqual("Triangle2D".Length, savedBytes[0]);
    var reconstructed = data.CreateFromMemoryStream();
    Assert.AreEqual(Triangle2D.Zero, reconstructed);
}
See Also