Esempio n. 1
0
        private ListAddressInfo testGetAddressN_one(object no)
        {
            var client = new ServiceKeeperReference.ServiceKeeperClient();

            var step = 20;
            var ret  = new ListAddressInfo();

            for (int i = 0; i < step * 2; i++)
            {
                var info = new GetAddressInfo();
                info.No = no.ToString();

                try
                {
                    info.BeginTime = DateTime.Now;

                    var address = client.GetServiceAddress("calc");

                    info.EndTime = DateTime.Now;
                    info.Message = address.Address;
                }
                catch (Exception ex)
                {
                    info.EndTime = DateTime.Now;
                    info.Message = "error";
                }

                ret.Add(info);
            }

            client.Close();

            return(ret);
        }
Esempio n. 2
0
        public void TestGetAddress()
        {
            var client = new ServiceKeeperReference.ServiceKeeperClient();

            var address = client.GetServiceAddress("calc");

            Assert.IsNotNull(address);

            Assert.IsNotNull(address.Address);

            client.Close();
        }
Esempio n. 3
0
        public void TestGetAddressN_SingleUser()
        {
            string current = string.Empty, prev = null;
            var    client = new ServiceKeeperReference.ServiceKeeperClient();

            var step = 20;

            for (int i = 0; i < step * 5; i++)
            {
                prev = current;

                try
                {
                    var address = client.GetServiceAddress("calc");

                    Assert.IsNotNull(address);

                    Assert.IsNotNull(address.Address);

                    current = address.Address;

                    if (i % step == 0)
                    {
                        Assert.AreNotEqual(current, prev);
                    }
                    else
                    {
                        Assert.AreEqual(current, prev);
                    }
                }
                catch (CommunicationException ex)
                {
                }
            }

            client.Close();
        }