/
HttpClientHelperTests.cs
46 lines (41 loc) · 1.52 KB
/
HttpClientHelperTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using FluentAssertions;
using System;
using System.Net.Http;
using unirest_net.http;
using unirest_net.request;
#if NETFX_CORE || WINDOWS_PHONE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
#else
using Microsoft.VisualStudio.TestTools.UnitTesting;
#endif
namespace unirest_net_tests.http
{
[TestClass]
public class HttpClientHelperTests
{
[TestMethod]
public void HttpClientHelper_Should_Request()
{
Action request = () => HttpClientHelper.Request<string>(new HttpRequest(HttpMethod.Get, "http://www.google.com"));
request.ShouldNotThrow();
}
[TestMethod]
public void HttpClientHelper_Should_Request_Async()
{
Action request = () => HttpClientHelper.RequestAsync<string>(new HttpRequest(HttpMethod.Get, "http://www.google.com"));
request.ShouldNotThrow();
}
[TestMethod]
public void HttpClientHelper_Should_Request_With_Fields()
{
Action request = () => HttpClientHelper.Request<string>(new HttpRequest(HttpMethod.Post, "http://www.google.com").field("test","value"));
request.ShouldNotThrow();
}
[TestMethod]
public void HttpClientHelper_Should_Request_Async_With_Fields()
{
Action request = () => HttpClientHelper.RequestAsync<string>(new HttpRequest(HttpMethod.Post, "http://www.google.com").field("test", "value"));
request.ShouldNotThrow();
}
}
}