public void Test()
        {
            Ohtapi ohtapi = new Ohtapi(Tools.TestPublicKey, Tools.TestSecretKey, true);

            Assert.IsNotNull(ohtapi);

            var result = ohtapi.Account();

            Assert.IsNotNull(result);
            Assert.AreEqual(0, result.Status.Code);

            ohtapi = new Ohtapi("", "", true);
            result = ohtapi.Account();

            Assert.IsNotNull(result);
            Assert.AreNotEqual(0, result.Status.Code);
            Assert.AreNotEqual(-1, result.Status.Code);

            var provider = Substitute.For <IAccountProvider>();

            ohtapi.AccountProvider = provider;
            provider.Get(string.Empty, null, string.Empty, string.Empty).ReturnsForAnyArgs(ExpectedJsonResultOk);

            result = ohtapi.Account();

            Assert.IsNotNull(result);
            Assert.AreEqual(0, result.Status.Code);

            provider.Get(string.Empty, null, string.Empty, string.Empty).ReturnsForAnyArgs(ExpectedJsonResultErr);
            result = ohtapi.Account();

            Assert.IsNotNull(result);
            Assert.AreNotEqual(0, result.Status.Code);
            Assert.AreNotEqual(-1, result.Status.Code);

            provider.Get(string.Empty, null, string.Empty, string.Empty).ReturnsForAnyArgs(string.Empty);
            result = ohtapi.Account();

            Assert.IsNotNull(result);
            Assert.AreEqual(-1, result.Status.Code);
        }
Beispiel #2
0
        private void butAccount_Click(object sender, EventArgs e)
        {
            var r = _api.Account();

            MessageBox.Show(r.ToString());
        }