Example #1
0
        public void SendWithInvalidHttpMethodTest()
        {
            // Arrange
            var request = new HttpRequest("data", new HttpMethod("DarkwingDuck"));

            // Act
            var task = _classUnderTest.SendAsync(request);

            task.Exception.InnerException.GetType().Should().Be(typeof(NotSupportedException));
            task.Wait();
        }
Example #2
0
        public async void PostByHttpRequestMessage()
        {
            var json = "{ \"title\": \"Lorem Ipsum\", \"userId\": 1 }";

            var request = new HttpRequestMessage
            {
                Method     = HttpMethod.Post,
                Content    = new StringContent(json, Encoding.UTF8, "application/json"),
                RequestUri = new Uri("todos", UriKind.Relative)
            };

            var response = await client.SendAsync(request);

            Assert.True(response.IsSuccessStatusCode);
        }