diff --git a/UnitTest/Bootstrap.Admin/Api/RegisterTest.cs b/UnitTest/Bootstrap.Admin/Api/RegisterTest.cs new file mode 100644 index 00000000..57d9efc8 --- /dev/null +++ b/UnitTest/Bootstrap.Admin/Api/RegisterTest.cs @@ -0,0 +1,32 @@ +using Bootstrap.DataAccess; +using System.Linq; +using Xunit; + +namespace Bootstrap.Admin.Api +{ + public class RegisterTest : ApiTest + { + public RegisterTest(BAWebHost factory) : base(factory, "Register", true) + { + + } + + [Fact] + public async void Get_Ok() + { + var resp = await Client.GetAsJsonAsync("?userName=Admin"); + Assert.False(resp); + } + + [Fact] + public async void Post_Ok() + { + // register new user + var nusr = new User() { UserName = "UnitTest-RegisterController", DisplayName = "UnitTest", Password = "1", Description = "UnitTest" }; + var resp = await Client.PostAsJsonAsync("", nusr); + Assert.True(resp); + + nusr.Delete(nusr.RetrieveNewUsers().Where(u => u.UserName == nusr.UserName).Select(u => u.Id)); + } + } +}