单元测试:修改ApproveUser_Ok单元测试,先删除,再插入,再授权,再删除测试数据
This commit is contained in:
parent
034fedfddb
commit
2f5be3a1d0
|
@ -119,6 +119,7 @@ namespace Bootstrap.DataAccess
|
|||
/// <param name="value"></param>
|
||||
public virtual bool Delete(IEnumerable<string> value)
|
||||
{
|
||||
if (!value.Any()) return true;
|
||||
bool ret = false;
|
||||
var db = DbManager.Db;
|
||||
try
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess
|
||||
|
@ -50,7 +51,13 @@ namespace Bootstrap.DataAccess
|
|||
public void ApproveUser_Ok()
|
||||
{
|
||||
var u = new User();
|
||||
Assert.True(u.Approve("3", "Administrators"));
|
||||
u.Delete(u.Retrieves().Where(usr => usr.UserName == "UnitTest").Select(usr => usr.Id));
|
||||
|
||||
var up = new User() { UserName = "UnitTest", Password = "123", Description = "新建用户用于测试批准", DisplayName = "UnitTest", Icon = "default.jpg" };
|
||||
u.Save(up);
|
||||
Assert.True(u.Approve(up.Id, "Administrators"));
|
||||
|
||||
u.Delete(new string[] { up.Id });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
Loading…
Reference in New Issue