public void QueryRoleFunctionEditRoleTest() { #region arrange List <RoleVO> reRoleVOList = new List <RoleVO>() { new RoleVO() { RoleID = 1, RoleName = "Admin", Description = "最高權限" }, new RoleVO() { RoleID = 2, RoleName = "A", Description = "A1" }, new RoleVO() { RoleID = 3, RoleName = "B", Description = "B1" } }; PageDataVO pageDataVO = new PageDataVO() { PageNumber = 1, WhereCondition = new List <KeyValueVO>() { new KeyValueVO() { Key = "RoleName", Value = "" } } }; _roleService.Stub(o => o.GetRoleData(pageDataVO)).Return(reRoleVOList); #endregion #region act var resultData = _target.QueryRoleFunctionEditRole(pageDataVO); var result = (RoleTableResultVO)((JsonResult)resultData).Data; var roleData = result.RoleData.ToList(); #endregion #region assert // 驗證資料 for (int i = 0; i < roleData.Count; i++) { Assert.AreEqual(roleData[i].RoleID, reRoleVOList[i].RoleID); Assert.AreEqual(roleData[i].RoleName, reRoleVOList[i].RoleName); Assert.AreEqual(roleData[i].Description, reRoleVOList[i].Description); } #endregion }