public void DeserializeNilObject() { string xml = "<value><nil /></value>"; object o = Utils.ParseValue(xml, typeof(object)); Assert.IsNull(o); }
public void DeserializeInvalidValueEnum() { string xml = "<value>Ten</value>"; object o = Utils.ParseValue(xml, typeof(IntEnum)); Assert.IsInstanceOf <IntEnum>(o); Assert.AreEqual(IntEnum.Two, o); }
public void DeserializeMissingValue() { string xml = "<value><i4>1234</i4></value>"; object o = Utils.ParseValue(xml, typeof(IntEnum)); Assert.IsInstanceOf <IntEnum>(o); Assert.AreEqual(IntEnum.Two, o); }
public void DeserializeULongEnum() { string xml = "<value><i8>2</i8></value>"; object o = Utils.ParseValue(xml, typeof(ULongEnum)); Assert.IsInstanceOf <ULongEnum>(o); Assert.AreEqual(ULongEnum.Two, o); }
public void DeserializeShortEnum() { string xml = "<value><i4>2</i4></value>"; object o = Utils.ParseValue(xml, typeof(ShortEnum)); Assert.IsInstanceOf <ShortEnum>(o); Assert.AreEqual(ShortEnum.Two, o); }
public void DeserializeEmpty() { object retVal = Utils.ParseValue(expectedEmptyArray, typeof(int[])); Assert.IsInstanceOf <int[]>(retVal); int[] ret = (int[])retVal; Assert.IsTrue(ret.Length == 0); }
public void DeserializeMultiDim() { object retVal = Utils.ParseValue(expectedMultiDim, typeof(int[, ])); Assert.IsInstanceOf <int[, ]>(retVal); int[,] ret = (int[, ])retVal; Assert.AreEqual(1, ret[0, 0]); Assert.AreEqual(2, ret[0, 1]); Assert.AreEqual(3, ret[1, 0]); Assert.AreEqual(4, ret[1, 1]); Assert.AreEqual(5, ret[2, 0]); Assert.AreEqual(6, ret[2, 1]); }
public void DeserializeJagged() { object retVal = Utils.ParseValue(expectedJagged, typeof(int[][])); Assert.IsInstanceOf <int[][]>(retVal); int[][] ret = (int[][])retVal; Assert.IsTrue(ret[0].Length == 0); Assert.IsTrue(ret[1].Length == 1); Assert.IsTrue(ret[2].Length == 2); Assert.AreEqual(1, ret[1][0]); Assert.AreEqual(2, ret[2][0]); Assert.AreEqual(3, ret[2][1]); }
public void DeserializeIntOverflow() { string xml = "<value><i4>" + maxIntPlusOne.ToString() + "</i4></value>"; object o = Utils.ParseValue(xml, typeof(IntEnum)); }