public void Test_UserRolePrivilegeUpdate_Initialize() { var role = new UserRole { Id = 1, Title = "test", IsDefault = true, Privilege = Privileges.Create }; var value = new UserRolePrivilegeUpdate(); var roles = new List<UserRole> { role }; var relations = new List<UserRoleRelation> { new UserRoleRelation { Id = 1, Privilege = Privileges.Update, Role = role, User = new User {Id = 1} } }; value.Initialize(new User { Id = 1 }, roles, relations); Assert.AreEqual(1, value.Values.Count, "Values"); Assert.AreEqual("test", value.Values[0].Role.Title, "Role.Title"); Assert.AreEqual(2, value.Values[0].Privileges.Count(x => x.Selected), "Privilege"); }
public void Test_UserRoleService_Insert() { var role = new UserRole { Title = "Test2" }; this.UserRoleService.Insert(role); Assert.AreEqual("test2", role.Slug, "Slug"); }
/// <summary> /// Initializes a new instance of the <see cref="UserRoleDelete"/> class. /// </summary> /// <param name="role">The role.</param> public UserRoleDelete(UserRole role) { if (role == null) { throw new ArgumentNullException("role"); } this.Id = role.Id; this.Title = role.Title; }
public void Test_UserRoleService_InsertOrUpdate() { var privileges = new List<UserRoleRelationUpdateValue> { new UserRoleRelationUpdateValue {Privilege = 2, Selected = true}, new UserRoleRelationUpdateValue {Privilege = 4, Selected = true} }; var role = new UserRole { Title = "test4" }; this.UserRoleService.InsertOrUpdate(role, privileges); Assert.AreEqual(2, role.Id, "Id"); Assert.AreEqual("test4", role.Title, "Title"); Assert.AreEqual(Privileges.ViewAny | Privileges.Create, role.Privilege, "Privilege"); }
public void Test_UserRoleCreateOrUpdate_ValueToModel() { var value = new UserRoleCreateOrUpdate { Title = "test", IsDefault = true, IsAdministrator = true, Privilege = Privileges.Create }; var role = new UserRole(); value.ValueToModel(role); Assert.AreEqual("test", role.Title, "Title"); Assert.AreEqual(true, role.IsDefault, "IsDefault"); Assert.AreEqual(true, role.IsAdministrator, "IsAdministrator"); }
public void Update(UserRole entity) { }
public void InsertOrUpdate(UserRole role, IList<UserRoleRelationUpdateValue> privileges) { }
public void Insert(UserRole entity) { }
public void Delete(UserRole entity) { }