BinaryDataLoadSaveTests SaveAndLoadClassWithArrays 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 SaveAndLoadClassWithArrays()
Examples

[Test]
public void SaveAndLoadClassWithArrays()
{
    var instance = new ClassWithArrays();
    var data = BinaryDataExtensions.SaveDataIntoMemoryStream(instance);
    var retrieved =
        BinaryDataExtensions.LoadDataWithKnownTypeFromMemoryStream<ClassWithArrays>(data);
    Assert.IsTrue(retrieved.byteData.Compare(new byte[] { 1, 2, 3, 4, 5 }),
        retrieved.byteData.ToText());
    Assert.IsTrue(retrieved.charData.Compare(new[] { 'a', 'b', 'c' }),
        retrieved.charData.ToText());
    Assert.IsTrue(retrieved.intData.Compare(new[] { 10, 20, 30 }), retrieved.intData.ToText());
    Assert.IsTrue(retrieved.stringData.Compare(new[] { "Hi", "there" }),
        retrieved.stringData.ToText());
    Assert.IsTrue(retrieved.enumData.Compare(new[] { DayOfWeek.Monday, DayOfWeek.Sunday }),
        retrieved.enumData.ToText());
    Assert.IsTrue(retrieved.byteEnumData.Compare(new[] { ByteEnum.Normal, ByteEnum.High }),
        retrieved.byteEnumData.ToText());
}
See Also