public async Task TestRethrowClientException()
        {
            var accountId = "GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA";
            var json      = BuildAccountResponse(accountId);

            When().Returns(ServerTest.ResponseMessage(HttpStatusCode.BadRequest, json));

            var tx = BuildTransaction(accountId);
            await Assert.ThrowsExceptionAsync <HttpResponseException>(() => _server.CheckMemoRequired(tx));
        }
        public async Task TestItDoesNotThrowIfAccountDoesNotHaveDataField()
        {
            var accountId = "GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA";
            var json      = BuildAccountResponse(accountId);

            When().Returns(ServerTest.ResponseMessage(HttpStatusCode.OK, json));

            var tx = BuildTransaction(accountId);
            await _server.CheckMemoRequired(tx);
        }
        public async Task TestFailsIfMemoIsRequired()
        {
            var accountId = "GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA";
            var data      = new Dictionary <string, string>()
            {
                { "config.memo_required", "MQ==" },
            };
            var json = BuildAccountResponse(accountId, data);

            When().Returns(ServerTest.ResponseMessage(HttpOk, json));

            var tx = BuildTransaction(accountId);
            await Assert.ThrowsExceptionAsync <AccountRequiresMemoException>(() => _server.CheckMemoRequired(tx));
        }
        public async Task TestDoesNotCheckDestinationMoreThanOnce()
        {
            var accountId = "GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA";
            var json      = BuildAccountResponse(accountId);

            When().Returns(ServerTest.ResponseMessage(HttpStatusCode.OK, json));

            var payment = new PaymentOperation
                          .Builder(KeyPair.FromAccountId(accountId), new AssetTypeNative(), "100.500")
                          .Build();

            var tx = BuildTransaction(accountId, new Operation[] { payment });
            await _server.CheckMemoRequired(tx);
        }
        public async Task TestCheckOtherOperationTypes()
        {
            var accountId    = "GAYHAAKPAQLMGIJYMIWPDWCGUCQ5LAWY4Q7Q3IKSP57O7GUPD3NEOSEA";
            var destinations = new string[]
            {
                "GASGNGGXDNJE5C2O7LDCATIVYSSTZKB24SHYS6F4RQT4M4IGNYXB4TIV",
                "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB",
                "GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ",
            };

            var native = new AssetTypeNative();
            var gbp    = Asset.CreateNonNativeAsset("GBP", "GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB");
            var eur    = Asset.CreateNonNativeAsset("EUR", "GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL");

            var operations = new Operation[]
            {
                new AccountMergeOperation.Builder(KeyPair.FromAccountId(destinations[0])).Build(),
                new PathPaymentStrictSendOperation.Builder(native, "5.00", KeyPair.FromAccountId(destinations[1]),
                                                           native, "5.00")
                .SetPath(new[] { gbp, eur })
                .Build(),
                new PathPaymentStrictReceiveOperation.Builder(native, "5.00", KeyPair.FromAccountId(destinations[2]),
                                                              native, "5.00")
                .SetPath(new[] { gbp, eur })
                .Build(),
                new ChangeTrustOperation.Builder(gbp, "10000").Build(),
            };

            When()
            .Returns(ServerTest.ResponseMessage(HttpStatusCode.OK, BuildAccountResponse(accountId)))
            .Returns(ServerTest.ResponseMessage(HttpStatusCode.OK, BuildAccountResponse(destinations[0])))
            .Returns(ServerTest.ResponseMessage(HttpStatusCode.OK, BuildAccountResponse(destinations[1])))
            .Returns(ServerTest.ResponseMessage(HttpStatusCode.OK, BuildAccountResponse(destinations[2])));

            var tx = BuildTransaction(accountId, operations, Memo.None());
            await _server.CheckMemoRequired(tx);
        }