Example #1
0
        public void HeadersAndPayloadAreNotDisposed()
        {
            FakeServiceClient fakeClient = null;

            try
            {
                fakeClient = new FakeServiceClient(new HttpClientHandler(),
                                                   new MirrorDelegatingHandler());
                var response = fakeClient.DoStuffAndThrowSync("Text");
                Assert.True(false);
            }
            catch (HttpOperationException ex)
            {
                fakeClient.Dispose();
                fakeClient = null;
                GC.Collect();
                Assert.NotNull(ex.Request);
                Assert.NotNull(ex.Response);
                Assert.Equal("2013-11-01", ex.Request.Headers["x-ms-version"].First());
                Assert.Equal("Text", ex.Response.Content);
            }
        }
 public void HeadersAndPayloadAreNotDisposed()
 {
     FakeServiceClient fakeClient = null;
     try
     {
         fakeClient = new FakeServiceClient(new HttpClientHandler(),
              new MirrorDelegatingHandler());
         var response = fakeClient.DoStuffAndThrowSync("Text");
         Assert.True(false);
     }
     catch (HttpOperationException ex)
     {
         fakeClient.Dispose();
         fakeClient = null;
         GC.Collect();
         Assert.NotNull(ex.Request);
         Assert.NotNull(ex.Response);
         Assert.Equal("2013-11-01", ex.Request.Headers["x-ms-version"].First());
         Assert.Equal("Text", ex.Response.Content);
     }
 }