public void DeserializeNonIndexedArray() { // given var data = Hex.EightByteNonIndexedArray; // when var value = VPack.ToObject <List <object> >(data); // then // array Assert.IsInstanceOf <List <object> >(value); Assert.AreEqual(3, value.Count); // first item var item1 = value[0]; Assert.IsInstanceOf <sbyte>(item1); Assert.AreEqual(1, item1); // second item var item2 = value[1]; Assert.IsInstanceOf <sbyte>(item2); Assert.AreEqual(2, item2); // third item var item3 = value[2]; Assert.IsInstanceOf <sbyte>(item3); Assert.AreEqual(3, item3); }
public void DeserializeCompactArray() { // TODO: cast to List<sbyte> // given var data = Converter.ToVPackBytes(Paths.JsonCompactArray, true, false); // when var value = VPack.ToObject <List <object> >(data); // then // array Assert.IsInstanceOf <List <object> >(value); Assert.AreEqual(3, value.Count); // first item var item1 = value[0]; Assert.IsInstanceOf <sbyte>(item1); Assert.AreEqual(1, item1); // second item var item2 = value[1]; Assert.IsInstanceOf <sbyte>(item2); Assert.AreEqual(2, item2); // third item var item3 = value[2]; Assert.IsInstanceOf <sbyte>(item3); Assert.AreEqual(3, item3); }
public void DeserializeNullValue() { // given var data = Converter.ToVPackBytes(Paths.JsonNullValue); // when var value = VPack.ToObject <object>(data); // then Assert.IsNull(value); }
public void DeserializeEightByteUnsignedIntValue() { // given var data = Converter.ToVPackBytes(Paths.JsonEightByteUnsignedInt); // when var value = VPack.ToObject <ulong>(data); // then Assert.AreEqual(18446744073709551615, value); }
public void DeserializeOneByteSignedIntValue() { // given var data = Converter.ToVPackBytes(Paths.JsonOneByteSignedInt); // when var value = VPack.ToObject <sbyte>(data); // then Assert.AreEqual((sbyte)-12, value); }
public void DeserializeSevenByteSignedIntValue() { // given var data = Converter.ToVPackBytes(Paths.JsonSevenByteSignedInt); // when var value = VPack.ToObject <long>(data); // then Assert.AreEqual(-1234567890123456, value); }
public void DeserializeTwoByteSignedIntValue() { // given var data = Converter.ToVPackBytes(Paths.JsonTwoByteSignedInt); // when var value = VPack.ToObject <short>(data); // then Assert.AreEqual((short)-12345, value); }
public void DeserializeSevenByteUnsignedIntValue() { // given var data = Converter.ToVPackBytes(Paths.JsonSevenByteUnsignedInt); // when var value = VPack.ToObject <ulong>(data); // then Assert.AreEqual((ulong)72057594037927935, value); }
public void DeserializeSixByteUnsignedIntValue() { // given var data = Converter.ToVPackBytes(Paths.JsonSixByteUnsignedInt); // when var value = VPack.ToObject <ulong>(data); // then Assert.AreEqual((ulong)281474976710655, value); }
public void DeserializeFiveByteUnsignedIntValue() { // given var data = Converter.ToVPackBytes(Paths.JsonFiveByteUnsignedInt); // when var value = VPack.ToObject <ulong>(data); // then Assert.AreEqual((ulong)1099511627775, value); }
public void DeserializeFourByteUnsignedIntValue() { // given var data = Converter.ToVPackBytes(Paths.JsonFourByteUnsignedInt); // when var value = VPack.ToObject <uint>(data); // then Assert.AreEqual(4294967295, value); }
public void DeserializeThreeByteUnsignedIntValue() { // given var data = Converter.ToVPackBytes(Paths.JsonThreeByteUnsignedInt); // when var value = VPack.ToObject <uint>(data); // then Assert.AreEqual((uint)16777215, value); }
public void DeserializeDoubleValue() { // given var data = Converter.ToVPackBytes(Paths.JsonDouble); // when var value = VPack.ToObject <double>(data); // then Assert.AreEqual(0.33333333333333331, value); }
public void DeserializePosOneByteFloatValue() { // given var data = Hex.PosOneByteLengthFloatValue; // when var value = VPack.ToObject <float>(data); // then Assert.AreEqual((float)12345, value); }
public void DeserializeMinKeyValue() { // given var data = Hex.MinKeyValue; // when var value = VPack.ToObject <object>(data); // then Assert.IsNull(value); }
public void DeserializeNoneValue() { // given var data = new byte[] { 0x00 }; // when var value = VPack.ToObject <object>(data); // then Assert.IsNull(value); }
public void DeserializeZeroIntValue() { // given var data = Converter.ToVPackBytes(Paths.JsonZeroInt); // when var value = VPack.ToObject <sbyte>(data); // then Assert.AreEqual(0, value); }
public void DeserializeFalseBooleanValue() { // given var data = Converter.ToVPackBytes(Paths.JsonFalseValue); // when var value = VPack.ToObject <bool>(data); // then Assert.IsFalse(value); }
public void DeserializeEmptyArray() { // given var data = Converter.ToVPackBytes(Paths.JsonEmptyArray); // when var value = VPack.ToObject <List <object> >(data); // then Assert.IsInstanceOf <List <object> >(value); Assert.AreEqual(0, value.Count); }
public void DeserializeNonIndexedArray_With_FourZeroByteByteLengthSize() { // given var data = Hex.FourByteNonIndexedArrayWithFourZeroBytes; // when var value = VPack.ToObject <List <object> >(data); // then // array Assert.IsInstanceOf <List <object> >(value); Assert.AreEqual(3, value.Count); TestSmallIntegerItems(value); }