Пример #1
0
        static void Main(string[] args)
        {
            const String HOST = "http://colunode.cloudapp.net";
            const String USERNAME = "******";
            const String PASSWORD = "******";
            string a;

            using (IAddressClient client = new Client(HOST))
            {
                String id = Guid.NewGuid().ToString();
                var response = client.GetAddressAsync(id).Result;
                a = response.Address;
            }

            using (Client client = new Client(HOST))
            {
                var request = new Colu.Models.IssueAsset.Request()
                {
                    Id = Guid.NewGuid().ToString()
                };

                request.Param.Amount = 1000;
                request.Param.Divisibility = 0;
                request.Param.Reissueable = true;
                request.Param.IssueAddress = a;

                var actual = client.IssueAsync(request).Result;

            }
        }
Пример #2
0
        public async Task Should_Not_Get_HD_Address_With_Invalid_Credentials()
        {
            using (IAddressClient client = new Client(HOST, USERNAME, "InvalidPassword"))
            {
                String id = Guid.NewGuid().ToString();
                var response = await client.GetAddressAsync(id);

                Assert.IsFalse(String.IsNullOrEmpty(response.Result));
            }
        }
Пример #3
0
        public async Task Should_Get_HD_Address()
        {
            using (IAddressClient client = new Client(HOST, USERNAME, PASSWORD))
            {
                String id = Guid.NewGuid().ToString();
                var response = await client.GetAddressAsync(id);

                Assert.IsFalse(String.IsNullOrEmpty(response.Result));
                Assert.AreEqual(id, response.Id);

                System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("^[2mn][1-9A-HJ-NP-Za-km-z]{26,35}");
                var match = regex.Match(response.Result);

                Assert.IsTrue(match.Success);
            }
        }