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) { }
public Boolean isValidSignedMsg(TransferHashed message) { return isValidSignedMsg(message.Hash); }
public SignedMessage SignMessage(TransferHashed transfer) { return SignMessage(transfer.Hash); }
public virtual Boolean isValidSignedMsg(TransferHashed previous) { return info.PreviousTransSignedByMe.isValidSignedMsg(previous); }