OpenAuth.Net/OpenAuth.UnitTest/TestUser.cs
2017-11-30 17:47:41 +08:00

61 lines
1.5 KiB
C#

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenAuth.App;
using OpenAuth.App.Request;
using OpenAuth.App.Response;
namespace OpenAuth.UnitTest
{
[TestClass]
public class TestUser : TestBase
{
private UserManagerApp _app;
public TestUser()
{
_app = AutofacExt.GetFromFac<UserManagerApp>();
}
[TestMethod]
public void AddUser()
{
try
{
for (int i = 0; i < 2; i++)
{
var random = new Random();
int val = random.Next();
_app.AddOrUpdate(new UserView
{
Account = "test" + val,
Name = "test" + val,
CreateTime = DateTime.Now,
OrganizationIds = "990cb229-cc18-41f3-8e2b-13f0f0110798,08f41bf6-4388-4b1e-bd3e-2ff538b44b1b",
Organizations = "研发部,研发1组",
});
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
[TestMethod]
public void GetUser()
{
var request = new QueryUserListReq
{
orgId = "543a9fcf-4770-4fd9-865f-030e562be238",
page = 1,
limit = 30
};
var users = _app.Load(request);
Console.WriteLine(users.count);
}
}
}