コード例 #1
0
 public void TestBalanceException()
 {
     using var client = new Client.Client(key, host);
     using CancellationTokenSource source = new();
     source.Cancel();
     try
     {
         var balance = client.GetBalance(context: source.Token).Result;
         Assert.AreEqual(0, balance.Value);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         if (e is AggregateException ae)
         {
             foreach (var ie in ae.InnerExceptions)
             {
                 if (ie is RpcException re)
                 {
                     Assert.AreEqual(StatusCode.Cancelled, re.StatusCode);
                 }
             }
         }
     }
 }
コード例 #2
0
        public void TestBalance()

        {
            using var client = new Client.Client(key, host);
            var balance = client.GetBalance().Result;

            Assert.AreEqual(8u, balance.Precision);
            Assert.AreEqual(0, balance.Value);
        }
コード例 #3
0
        public void TestBalanceWithOwner()
        {
            var address = "NiXweMv91Vz512bQw7jFNHAGBg8upVS8Qo";

            using var client = new Client.Client(key, host);
            var balance = client.GetBalance(OwnerID.FromAddress(address)).Result;

            Assert.AreEqual(0, balance.Value);
        }