private void BalanceLive() { var apiInstance = new DefaultApi(nodeAddress); // Genesis address check, should not have a balance var result = JsonConvert.DeserializeObject <Balance>(apiInstance.BalanceGet("2jBbGxZRGoQG1mqhPBnXnLTxK6oxsTf8os6") .ToString()); Assert.Equal(result, new Balance { Addresses = new Dictionary <string, BalancePair> { ["2jBbGxZRGoQG1mqhPBnXnLTxK6oxsTf8os6"] = new BalancePair() } }); // Balance of final distribution address. Should have the same coins balance // for the next 15-20 years. result = JsonConvert.DeserializeObject <Balance>(apiInstance .BalanceGet("ejJjiCwp86ykmFr5iTJ8LxQXJ2wJPTYmkm") .ToString()); Assert.Equal(result.Confirmed.coins, result.Predicted.coins); Assert.Equal(result.Confirmed.hours, result.Predicted.hours); Assert.NotEqual(0, result.Confirmed.hours); // Add 1e4 because someone sent 0.01 coins to it decimal expectedBalance = decimal.Parse("1E6", NumberStyles.Any) * decimal.Parse("1E6", NumberStyles.Any) + decimal.Parse("1E4", NumberStyles.Any); Assert.Equal(expectedBalance, result.Confirmed.coins); // Check that the balance is queryable for addresses known to be affected // by the coinhour overflow problem var address = new string[] { "n7AR1VMW1pK7F9TxhYdnr3HoXEQ3g9iTNP", "2aTzmXi9jyiq45oTRFCP9Y7dcvnT6Rsp7u", "FjFLnus2ePxuaPTXFXfpw6cVAE5owT1t3P", "KT9vosieyWhn9yWdY8w7UZ6tk31KH4NAQK" }; Assert.All(address, s => apiInstance.BalanceGet(s)); apiInstance.BalanceGet(string.Join(",", address)); }
private void BalanceStable() { var apiInstance = new DefaultApi(nodeAddress); var testCase = new[] { new { name = "unknown address", addrs = new[] { "prRXwTcDK24hs6AFxj69UuWae3LzhrsPW9" }, file = "balance-noaddrs.golden" }, new { name = "one address", addrs = new[] { "2THDupTBEo7UqB6dsVizkYUvkKq82Qn4gjf" }, file = "balance-2THDupTBEo7UqB6dsVizkYUvkKq82Qn4gjf.golden" }, new { name = "duplicate address", addrs = new[] { "2THDupTBEo7UqB6dsVizkYUvkKq82Qn4gjf", "2THDupTBEo7UqB6dsVizkYUvkKq82Qn4gjf" }, file = "balance-2THDupTBEo7UqB6dsVizkYUvkKq82Qn4gjf.golden" }, new { name = "two address", addrs = new[] { "2THDupTBEo7UqB6dsVizkYUvkKq82Qn4gjf", "212mwY3Dmey6vwnWpiph99zzCmopXTqeVEN" }, file = "balance-two-addrs.golden" } }; foreach (var tc in testCase) { var resultg = apiInstance.BalanceGet(string.Join(",", tc.addrs)); CheckGoldenFile(tc.file, resultg); if (useCsrf) { apiInstance.Configuration.AddApiKeyPrefix("X-CSRF-TOKEN", GetCsrf()); } var resultp = apiInstance.BalancePost(string.Join(",", tc.addrs)); Assert.Equal(resultg, resultp); } }