public void SerializationWorks_Strings(IByteConverter <string> byteConverter) { const string s = "test-string"; var serialized = byteConverter.GetBytes(s); var deserialized = byteConverter.GetObject(serialized); Assert.Equal(s, deserialized); }
public void SerializationWorks_ComplexType(IByteConverter <ComplexType> byteConverter) { var complexType = ComplexType.Create(3, 3); var serialized = byteConverter.GetBytes(complexType); var deserialized = byteConverter.GetObject(serialized); var expected = complexType.BreadthFirstEnumeration().ToArray(); var actual = deserialized.BreadthFirstEnumeration().ToArray(); for (var i = 0; i < expected.Length; i++) { var e = expected[i]; var a = actual[i]; Assert.Equal(e.Id, a.Id); } }