Esempio n. 1
0
        public void BasicCommTest()
        {
            string response;
            var start = Environment.TickCount;
            using (var client = new TestServiceClient("proto"))
            {
                var d = client.GetDataUsingDataContractAsync(new CompositeType()
                {
                    BoolValue = true,
                    StringValue = "Test"
                });

                var composite = d.GetAwaiter().GetResult();

                AssertComposite(composite);

                response = client.GetData(2);
            }
            var end = Environment.TickCount - start;

            Console.WriteLine(end);

            Assert.IsNotNull(response);

            Assert.IsTrue(response.Equals("2", StringComparison.Ordinal),
                "response was unexpected, expected : {0}, actual: {1}", "2", response);
        }
        public void BasicCommTest()
        {
            string response;
            var    start = Environment.TickCount;

            using (var client = new TestServiceClient("proto"))
            {
                var d = client.GetDataUsingDataContractAsync(new CompositeType()
                {
                    BoolValue   = true,
                    StringValue = "Test"
                });

                var composite = d.GetAwaiter().GetResult();

                AssertComposite(composite);

                response = client.GetData(2);
            }
            var end = Environment.TickCount - start;

            Console.WriteLine(end);

            Assert.IsNotNull(response);

            Assert.IsTrue(response.Equals("2", StringComparison.Ordinal),
                          "response was unexpected, expected : {0}, actual: {1}", "2", response);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            try
            {
                var client = new TestServiceClient();

                client.Open();

                string tmpString;
                int    tmpInt;

                tmpString = client.GetData(13);
                WriteLine($"\"{tmpString}\"");

                tmpInt = client.Sum(2, 3);
                WriteLine(tmpInt);
                tmpInt = client.Subtract(25, 5);
                WriteLine(tmpInt);
                tmpInt = client.Multiply(2, 3);
                WriteLine(tmpInt);
                tmpInt = client.Divide(25, 5);
                WriteLine(tmpInt);

                CompositeType compositeType = client.GetDataUsingDataContract(new CompositeType {
                    BoolValue = true, StringValue = "ClientStringValue"
                });
                WriteLine($"{{BoolValue:{compositeType.BoolValue}, StringValue:\"{compositeType.StringValue}\"}}");

                client.Close();
            }
            catch (Exception eException)
            {
                WriteLine(eException.GetType().FullName + Environment.NewLine + "Message: " + eException.Message + Environment.NewLine + (eException.InnerException != null && !string.IsNullOrEmpty(eException.InnerException.Message) ? "InnerException.Message" + eException.InnerException.Message + Environment.NewLine : string.Empty) + "StackTrace:" + Environment.NewLine + eException.StackTrace);
            }
        }
Esempio n. 4
0
 // GET api/values/5
 public string Get(int id)
 {
     using (var client = new TestServiceClient())
     {
         return(client.GetData(id));
     }
 }
        private void PrimitiveGet(string bindingName)
        {
            string response;

            using (var client = new TestServiceClient(bindingName))
            {
                response = client.GetData(2);
            }
            Assert.IsNotNull(response);

            Assert.IsTrue(response.Equals("2", StringComparison.Ordinal),
                          "response was unexpected, expected : {0}, actual: {1}", "2", response);
        }
Esempio n. 6
0
        private void PrimitiveGet(string bindingName)
        {
            string response;
            using (var client = new TestServiceClient(bindingName))
            {
                response = client.GetData(2);
            }
            Assert.IsNotNull(response);

            Assert.IsTrue(response.Equals("2", StringComparison.Ordinal),
                "response was unexpected, expected : {0}, actual: {1}", "2", response);
        }