public void TestMemoHash() { string hash = "TestHashTestHashTestHashTestHash"; Memo memo = Memo.MemoHash(hash); Assert.AreEqual(hash, memo.Hash); Assert.AreEqual(Memo.MemoTypeEnum.MEMO_HASH, memo.Type); Stellar.Generated.Memo genMemo = memo.ToXDR(); Assert.AreEqual(Encoding.ASCII.GetBytes(hash).ToString(), genMemo.Hash.InnerValue.ToString()); Assert.AreEqual(Stellar.Generated.MemoType.MemoTypeEnum.MEMO_HASH, genMemo.Discriminant.InnerValue); Memo resMemo = Memo.FromXDR(genMemo); Assert.AreEqual(hash, resMemo.Hash); Assert.AreEqual(Memo.MemoTypeEnum.MEMO_HASH, resMemo.Type); }
public void TestMemoHashWrong() { var ex = Assert.Throws <ArgumentException>(() => Memo.MemoHash("Wrong")); Assert.AreEqual(ex.Message, "Invalid hash."); }
public void TestMemoHashNone() { var ex = Assert.Throws <NullReferenceException>(() => Memo.MemoHash(null)); Assert.AreEqual(ex.Message, "textorhash cannot be null."); }