public void ObjectFromBytesTest() { Assert.Null(SerDeExtensions.FromBytes <ITestInterface>(null)); var testBytes = new byte[] { 1, 2, 123 }; Assert.Equal(testBytes, SerDeExtensions.FromBytes <byte[]>(testBytes)); }
public void StringToBytesRoundtripTest() { string testStr = "Test String Value"; byte[] bytes = SerDeExtensions.ToBytes(testStr); string convertedStr = SerDeExtensions.FromBytes(bytes); Assert.Equal(testStr, convertedStr); }
public void ObjectToBytesRoundtripTest() { ITestInterface testObj = new TestClass("Foo") { Prop2 = 100 }; byte[] bytes = SerDeExtensions.ToBytes(testObj); ITestInterface testObj2 = SerDeExtensions.FromBytes <TestClass>(bytes); Assert.NotNull(testObj2); Assert.Equal(testObj.GetProp1(), testObj2.GetProp1()); Assert.Equal(testObj.GetProp2(), testObj2.GetProp2()); }
public void FromBytesTest() { Assert.Equal(string.Empty, SerDeExtensions.FromBytes(null)); Assert.Equal(string.Empty, SerDeExtensions.FromBytes(new byte[0])); }