forked from yuezhongxin/MessageManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWebApiTest.cs
More file actions
39 lines (35 loc) · 1.07 KB
/
WebApiTest.cs
File metadata and controls
39 lines (35 loc) · 1.07 KB
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
/**
* author:xishuai
* address:https://www.github.com/yuezhongxin/MessageManager
**/
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
namespace MessageManager.WebAPI.Tests
{
[TestFixture]
public class WebApiTest
{
[Test]
public static void MessageWebAPI()
{
RunAsync().Wait();
}
static async Task RunAsync()
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://localhost:9283/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml"));
//HttpResponseMessage messages = await client.GetAsync("api/Message/GetMessagesBySendUser/张三");
string messages = await client.GetStringAsync("api/Message/GetMessagesBySendUser/张三");
}
}
}
}