public void Test_AddressCasting() { Address address = "hx0000000000000000000000000000000000000000"; Assert.AreEqual(address.GetType(), typeof(ExternalAddress)); Assert.AreEqual(address.ToString(), "hx0000000000000000000000000000000000000000"); ExternalAddress externalAddress = "hx0000000000000000000000000000000000000000"; Assert.AreEqual(externalAddress.ToHexhx(), address.ToString()); address = "cx0000000000000000000000000000000000000000"; Assert.AreEqual(address.GetType(), typeof(ContractAddress)); Assert.AreEqual(address.ToString(), "cx0000000000000000000000000000000000000000"); ContractAddress contractAddress = "cx0000000000000000000000000000000000000000"; Assert.AreEqual(contractAddress.ToHexcx(), address.ToString()); Assert.Throws(typeof(FormatException), () => { Address addr = "0000000000000000000000000000000000000000"; }); Assert.Throws(typeof(FormatException), () => { ExternalAddress addr = "0000000000000000000000000000000000000000"; }); Assert.Throws(typeof(FormatException), () => { ContractAddress addr = "0000000000000000000000000000000000000000"; }); }