EntityTests SaveAndLoadEmptyEntityFromMemoryStream Method Delta Engine Documentation

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

public void SaveAndLoadEmptyEntityFromMemoryStream()
Examples

[Test]
public void SaveAndLoadEmptyEntityFromMemoryStream()
{
    var data = BinaryDataExtensions.SaveToMemoryStream(new MockEntity());
    byte[] savedBytes = data.ToArray();
    Assert.AreEqual(GetShortNameLength("MockEntity") + 1 + 4 + 1 + 1, savedBytes.Length);
    var loadedEntity = data.CreateFromMemoryStream() as Entity;
    Assert.AreEqual(0, loadedEntity.NumberOfComponents);
    Assert.IsTrue(loadedEntity.IsActive);
}
See Also