Ejemplo n.º 1
0
        public void TestMemoReturnHash()
        {
            string retHash = "TestHashTestHashTestHashTestHash";
            Memo   memo    = Memo.MemoReturnHash(retHash);

            Assert.AreEqual(retHash, memo.RetHash);
            Assert.AreEqual(Memo.MemoTypeEnum.MEMO_RETURN, memo.Type);

            Stellar.Generated.Memo genMemo = memo.ToXDR();

            Assert.AreEqual(Encoding.ASCII.GetBytes(retHash).ToString(), genMemo.RetHash.InnerValue.ToString());
            Assert.AreEqual(Stellar.Generated.MemoType.MemoTypeEnum.MEMO_RETURN, genMemo.Discriminant.InnerValue);

            Memo resMemo = Memo.FromXDR(genMemo);

            Assert.AreEqual(retHash, resMemo.RetHash);
            Assert.AreEqual(Memo.MemoTypeEnum.MEMO_RETURN, resMemo.Type);
        }
Ejemplo n.º 2
0
        public void TestMemoReturnHashWrong()
        {
            var ex = Assert.Throws <ArgumentException>(() => Memo.MemoReturnHash("Wrong"));

            Assert.AreEqual(ex.Message, "Invalid retHash.");
        }
Ejemplo n.º 3
0
        public void TestMemoReturnHashNone()
        {
            var ex = Assert.Throws <NullReferenceException>(() => Memo.MemoReturnHash(null));

            Assert.AreEqual(ex.Message, "textorhash cannot be null.");
        }