2019-05-01 16:46:24 +08:00
|
|
|
|
using Longbow.Web;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
2019-05-15 00:22:13 +08:00
|
|
|
|
namespace Bootstrap.Admin.Api.SqlServer
|
2019-05-01 16:46:24 +08:00
|
|
|
|
{
|
|
|
|
|
public class OnlineTest : ControllerTest
|
|
|
|
|
{
|
|
|
|
|
public OnlineTest(BAWebHost factory) : base(factory, "api/OnlineUsers") { }
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public async void Get_Ok()
|
|
|
|
|
{
|
|
|
|
|
var users = await Client.GetAsJsonAsync<IEnumerable<OnlineUser>>();
|
|
|
|
|
Assert.Single(users);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public async void GetById_Ok()
|
|
|
|
|
{
|
|
|
|
|
var urls = await Client.GetAsJsonAsync<IEnumerable<KeyValuePair<DateTime, string>>>("UnitTest");
|
|
|
|
|
Assert.Empty(urls);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public async void Put_Ok()
|
|
|
|
|
{
|
2019-07-15 09:07:22 +08:00
|
|
|
|
// 三次 Put 请求后返回真
|
2019-08-03 16:03:48 +08:00
|
|
|
|
var ret = await Client.PutAsJsonAsync<string, bool>("");
|
2019-07-15 09:07:22 +08:00
|
|
|
|
ret = await Client.PutAsJsonAsync<string, bool>("");
|
|
|
|
|
ret = await Client.PutAsJsonAsync<string, bool>("");
|
|
|
|
|
ret = await Client.PutAsJsonAsync<string, bool>("");
|
|
|
|
|
Assert.True(ret);
|
2019-05-01 16:46:24 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|