Exemple #1
0
        public static void GoofyCreateAndTansferCoin_SouldHaveValidCoin()
        {
            //Arrange
            var goofySignature = new Signature(256);
            Global.GoofyPk = goofySignature.PublicKey;

            var destiny = new Signature(256);
            var goofyTransInfo = new TransferInfoCreateCoin(destiny.PublicKey, Counter.Coin);
            var transHashed = new TransferHashed(goofyTransInfo);
            var goofyList = new TransferListCreateCoin(transHashed);

            //Act
            var trans = new Transfers(transHashed, goofyList);

            //Assert
            try
            {
                if (!trans.isChainNotNull())
                    throw new Exception("Transfer chain be informed.");

                if (!trans.isInfoNotNull())
                    throw new Exception("Transfer informations must be informed.");

                if (!((TransferInfoCreateCoin)trans.Info).isValidCoinId())
                    throw new Exception("Coin id greater than 0.");

                if (!((TransferInfoCreateCoin)trans.Info).isDestinyPkNotNull())
                    throw new Exception("Destiny public key must be informed.");

                if (!trans.isHashNotNull())
                    throw new Exception("Transfer hash must be informed.");

                if (!trans.isValidHash())
                    throw new Exception("Invalid transfer hash.");

                //valid virtua method + all the balidations above
                trans.CheckTransfer();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
 public TransferListCreateCoin(TransferHashed trans)
     : base(null, trans)
 {
 }
Exemple #3
0
 public Boolean isValidSignedMsg(TransferHashed message)
 {
     return isValidSignedMsg(message.Hash);
 }
Exemple #4
0
 public SignedMessage SignMessage(TransferHashed transfer)
 {
     return SignMessage(transfer.Hash);
 }
Exemple #5
0
 public virtual Boolean isValidSignedMsg(TransferHashed previous)
 {
     return info.PreviousTransSignedByMe.isValidSignedMsg(previous);
 }