Blog.Common.Utils.Tests.Helpers.HttpClientHelperTest.ShouldThrowExceptionWhenHttpClientFromPutResponseIsNull C# (CSharp) Метод

ShouldThrowExceptionWhenHttpClientFromPutResponseIsNull() приватный Метод

private ShouldThrowExceptionWhenHttpClientFromPutResponseIsNull ( ) : void
Результат void
        public void ShouldThrowExceptionWhenHttpClientFromPutResponseIsNull()
        {
            var fakeResponse = new HttpResponseMessage(HttpStatusCode.Accepted) { Content = null };
            var fakeHandler = new FakeHttpMessageHandler(fakeResponse);
            var httpClient = new HttpClient(fakeHandler) { BaseAddress = new Uri("http://localhost/") };

            var testObj = new { Id = 1, Name = "foobar" };
            var httpClientHelper = new HttpClientHelper { HttpClientObj = httpClient };
            Assert.Throws<BlogException>(() => httpClientHelper.Put("http://localhost/", "foo", testObj));
        }