Exemple #1
0
        public void TestRequestAccountTums()
        {
            var deferred = new Task(() => { });

            _remote = new Remote(ServerUrl);
            MessageResult <AccountTumsResponse> response = null;

            _remote.Connect(r =>
            {
                var options     = new AccountTumsOptions();
                options.Account = "j9FGhAW9dSzL3RjbXkyW6Z6bHGxFk8cmB1";
                var req         = _remote.RequestAccountTums(options);
                req.Submit(r1 =>
                {
                    response = r1;
                    deferred.Start();
                });
            });
            Assert.IsTrue(deferred.Wait(DeferredWaitingTime));

            Assert.IsNotNull(response);
            var result = response.Result;

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.SendCurrencies);
            Assert.IsNotNull(result.ReceiveCurrencies);
        }
Exemple #2
0
        public void TestRequestAccountTums_Invalid()
        {
            var deferred = new Task(() => { });
            MessageResult <AccountTumsResponse> response = null;
            var options = new AccountTumsOptions();

            options.Account = "abcxyz";
            _remote.RequestAccountTums(options).Submit(r =>
            {
                response = r;
                deferred.Start();
            });

            Assert.IsTrue(deferred.Wait(DeferredWaitingTime));
            Assert.IsNotNull(response);
            Assert.IsInstanceOfType(response.Exception, typeof(InvalidAddressException));

            deferred                  = new Task(() => { });
            response                  = null;
            options                   = new AccountTumsOptions();
            options.Ledger            = new LedgerSettings();
            options.Ledger.LedgerHash = "abcxyz";
            _remote.RequestAccountTums(options).Submit(r =>
            {
                response = r;
                deferred.Start();
            });

            Assert.IsTrue(deferred.Wait(DeferredWaitingTime));
            Assert.IsNotNull(response);
            Assert.IsInstanceOfType(response.Exception, typeof(InvalidHashException));
        }
Exemple #3
0
        public void TestRequestAccountTumsResponse()
        {
            var remote = new Remote("");

            remote.SetMockServer(new MockServer(remote, "RequestAccountTums.json"));

            MessageResult <AccountTumsResponse> response = null;
            var deferred = new Task(() => { });
            var options  = new AccountTumsOptions();

            options.Account = "jJ3KZo6Zr3BVLiXBBKqMfQoQZHiYFZKNFT";
            remote.RequestAccountTums(options).Submit(r =>
            {
                response = r;
                deferred.Start();
            });

            Assert.IsTrue(deferred.Wait(DeferredWaitingTime));

            Assert.IsNotNull(response);
            var result = response.Result;

            Assert.IsNotNull(result);

            Assert.AreEqual("62F993679853F86A6193CBFC017F307A60A78B74D1E57C50676D74816B0CCFC6", result.LedgerHash);
            Assert.AreEqual((uint)9646172, result.LedgerIndex);

            Assert.IsNotNull(result.ReceiveCurrencies);
            Assert.AreEqual(1, result.ReceiveCurrencies.Length);
            Assert.AreEqual("CNY", result.ReceiveCurrencies[0]);

            Assert.IsNotNull(result.SendCurrencies);
            Assert.AreEqual(1, result.SendCurrencies.Length);
            Assert.AreEqual("USD", result.SendCurrencies[0]);
        }
Exemple #4
0
        private void InitRequestAccountTumsOptions()
        {
            var options = new AccountTumsOptions();

            options.Account = "j9FGhAW9dSzL3RjbXkyW6Z6bHGxFk8cmB1";
            options.Ledger  = new LedgerSettings();
            pgRequestAccountTumsOptions.SelectedObject = options;
        }