public void RemoveUsersFromRolesTest7() { try { AppleseedRoleProvider provider = Roles.Provider as AppleseedRoleProvider; Guid userId = new Guid("34ADB714-92B0-47ff-B5AF-5DB2E0D124A9"); // [email protected]; Guid[] users = new Guid[] { userId }; AppleseedRole editors = provider.GetRoleByName("Appleseed", "editors"); Guid[] roles = new Guid[1]; roles[0] = editors.Id; provider.AddUsersToRoles("Appleseed", users, roles); Assert.IsTrue(provider.IsUserInRole("Appleseed", userId, editors.Id)); provider.RemoveUsersFromRoles("Appleseed", users, roles); Assert.IsFalse(provider.IsUserInRole("Appleseed", userId, editors.Id)); } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in RemoveUsersFromRolesTest7" + ex.Message, ex); } }
public void DeleteRoleTest4() { try { AppleseedRoleProvider provider = Roles.Provider as AppleseedRoleProvider; AppleseedRole editors = provider.GetRoleByName("Appleseed", "editors"); provider.DeleteRole("invalidApp", editors.Id, true); Assert.Fail(); } catch (AppleseedRoleProviderException) { } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in DeleteRoleTest4" + ex.Message, ex); } }
public void AddUsersToRolesTest6() { try { AppleseedRoleProvider provider = Roles.Provider as AppleseedRoleProvider; AppleseedUser user = (AppleseedUser)Membership.GetUser("*****@*****.**"); Guid[] users = new Guid[1]; users[0] = user.ProviderUserKey; AppleseedRole role = provider.GetRoleByName("Appleseed", "clerks"); Guid[] roles = new Guid[1]; roles[0] = role.Id; provider.AddUsersToRoles("Appleseed", users, roles); } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in AddUsersToRolesTest6" + ex.Message, ex); } }
public void RemoveUsersFromRolesTest6() { try { AppleseedRoleProvider provider = Roles.Provider as AppleseedRoleProvider; Guid[] users = new Guid[1]; users[0] = new Guid("BE7DC028-7238-45D3-AF35-DD3FE4AEFB7E"); //"*****@*****.**"; AppleseedRole editors = provider.GetRoleByName("Appleseed", "salesman"); Guid[] roles = new Guid[1]; roles[0] = editors.Id; provider.RemoveUsersFromRoles("Appleseed", users, roles); Assert.Fail(); } catch (AppleseedRoleProviderException) { } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in RemoveUsersFromRolesTest6" + ex.Message, ex); } }