Ejemplo n.º 1
0
 public void Parallel_FormUrl_SimpleClass()
 {
     Parallel.For(1, 100, (i, s) =>
     {
         var result = ServiceClient.FormatUrl("abc.com", new TestClassA {
             A = i.ToString()
         }, HttpVerb.Get);
         Assert.Equal("abc.com?A=" + i.ToString(), result);
     });
 }
Ejemplo n.º 2
0
        public void Parallel_Post()
        {
            var serviceClient = new ServiceClient(new TestHttpHandler());

            Parallel.For(1, 60, (i, s) =>
            {
                var result = serviceClient.RequestAsync <ComplateClass>("http://www.bing.com", HttpVerb.Post, new { A = "a", B = (string)null }).ConfigureAwait(false).GetAwaiter().GetResult();
                Assert.Equal(result.A, "a");
                Assert.Equal(result.B, "b");
                Assert.NotNull(result.TestClassA);
                Assert.NotNull(result.ListInt);
                Assert.Null(result.TestClassB);
                Assert.Contains(1, result.ListInt);
            });
        }