BinaryDataLoadSaveTests SaveAndLoadExplicitLayoutStruct Method Delta Engine Documentation

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

public void SaveAndLoadExplicitLayoutStruct()
Examples

[Test]
public void SaveAndLoadExplicitLayoutStruct()
{
    var explicitLayoutTest = new ExplicitLayoutTestClass
    {
        someValue = 8,
        anotherValue = 5,
        unionValue = 7
    };
    var data = BinaryDataExtensions.SaveDataIntoMemoryStream(explicitLayoutTest);
    var retrieved =
        BinaryDataExtensions.LoadDataWithKnownTypeFromMemoryStream<ExplicitLayoutTestClass>(data);
    Assert.AreEqual(8, retrieved.someValue);
    Assert.AreEqual(7, retrieved.anotherValue);
    Assert.AreEqual(7, retrieved.unionValue);
}
See Also