public void ObjectToBytesTest() { Assert.Null(SerDeExtensions.ToBytes((object)null)); var testBytes = new byte[] { 1, 2, 123 }; Assert.Equal(testBytes, SerDeExtensions.ToBytes(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 StringToBytesTest() { byte[] bytes = SerDeExtensions.ToBytes(null); Assert.NotNull(bytes); Assert.Empty(bytes); bytes = SerDeExtensions.ToBytes(" "); Assert.NotNull(bytes); Assert.Empty(bytes); }
public void StringToBytesTest() { byte[] bytes = SerDeExtensions.ToBytes(null); Assert.NotNull(bytes); Assert.Equal(0, bytes.Length); bytes = SerDeExtensions.ToBytes(" "); Assert.NotNull(bytes); Assert.Equal(0, bytes.Length); }
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()); }