示例#1
0
        public void ShouldConstructProperly()
        {
            foreach (var address in DataSet)
            {
                var p = new PeercoinAddress(address);

                bool isValid = p.ToString() == address;
                Assert.IsTrue(isValid);
            }
        }
示例#2
0
        public void ShouldNotConstructProperly()
        {
            var bitcoins = new[] { "1sTybTznstbwufxRe4iALvgHV1ZZYq5uT", "1GEYVPaaxyzarNbZTB5WFPVoxnx8ekyrgD", "1t7BwrqQyTN1NBTYdDTGq3jZwDLL6g8dg" };

            var random = new[] { "1hgfZYq5uT", "1G NbZTB5WFYTRgD", "p1g", "" };

            foreach (var address in bitcoins.Concat(random))
            {
                var  valid      = PeercoinAddress.IsAddress(address);
                bool isnotValid = !valid;
                Assert.IsTrue(isnotValid);
            }
        }
示例#3
0
        public static bool IsAddress(string address)
        {
            var catched = false;

            try
            {
                // ReSharper disable once UnusedVariable
                var peercoinAddress = new PeercoinAddress(address);
            }
            catch (Exception)
            {
                catched = true;
            }
            return(!catched);
        }