public void ConvUtils_ToInt32() { Assert.AreEqual(0, ConvUtils.ToInt32Ex(""), "Result differs"); Assert.AreEqual(55, ConvUtils.ToInt32Ex("55"), "Result differs"); Assert.AreEqual(55, ConvUtils.ToInt32Ex("+55"), "Result differs"); Assert.AreEqual(-55, ConvUtils.ToInt32Ex("-55"), "Result differs"); Assert.AreEqual(0x55, ConvUtils.ToInt32Ex("0x55"), "Result differs"); Assert.AreEqual(0x55, ConvUtils.ToInt32Ex("0X55"), "Result differs"); Assert.AreEqual(3, ConvUtils.ToInt32Ex("0b11"), "Result differs"); Assert.AreEqual(5, ConvUtils.ToInt32Ex("0B101"), "Result differs"); Assert.AreEqual(0xFEDC, ConvUtils.ToInt32Ex("0XFEDC"), "Result differs"); Assert.AreEqual(-0xFEDC, ConvUtils.ToInt32Ex("-0xFEDC"), "Result differs"); int?nres; nres = ConvUtils.ToNullableInt32Ex(null); Assert.IsNull(nres, "Not null result"); nres = ConvUtils.ToNullableInt32Ex(String.Empty); Assert.IsNull(nres, "Not null result"); nres = ConvUtils.ToNullableInt32Ex(""); Assert.IsNull(nres, "Not null result"); nres = ConvUtils.ToNullableInt32Ex("0xAA"); Assert.AreEqual(0xAA, nres, "Result differs"); Assert.Throws <OverflowException>(() => ConvUtils.ToUInt32Ex("0xFFFFFFFFF")); }