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 DeleteRoleTest3() { try { AppleseedRoleProvider provider = Roles.Provider as AppleseedRoleProvider; provider.CreateRole("tempRole2"); provider.AddUsersToRoles(new string[] { "*****@*****.**" }, new string[] { "tempRole2" }); provider.DeleteRole("tempRole2", false); } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in DeleteRoleTest3" + ex.Message, ex); } }
public void AddUsersToRolesTest3() { try { AppleseedRoleProvider provider = Roles.Provider as AppleseedRoleProvider; string[] users = new string[1]; users[0] = "*****@*****.**"; string[] roles = new string[1]; roles[0] = "editors"; provider.AddUsersToRoles(users, roles); } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in AddUsersToRolesTest3" + ex.Message, ex); } }
public void RemoveUsersFromRolesTest8() { try { AppleseedRoleProvider provider = Roles.Provider as AppleseedRoleProvider; string[] users = new string[] { "*****@*****.**" }; string[] roles = new string[] { "editors" }; provider.AddUsersToRoles(users, roles); Assert.IsTrue(provider.IsUserInRole("*****@*****.**", "editors")); provider.RemoveUsersFromRoles(users, roles); Assert.IsFalse(provider.IsUserInRole("*****@*****.**", "editors")); } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in RemoveUsersFromRolesTest8" + 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 AddUsersToRolesTest5() { try { AppleseedRoleProvider provider = Roles.Provider as AppleseedRoleProvider; Guid[] users = new Guid[1]; users[0] = new Guid("BE7DC028-7238-45D3-AF35-DD3FE4AEFB7E"); //"*****@*****.**"; Guid[] roles = new Guid[1]; roles[0] = Guid.NewGuid(); provider.AddUsersToRoles("Appleseed", users, roles); Assert.Fail(); } catch (AppleseedRoleProviderException) { } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in AddUsersToRolesTest5" + ex.Message, ex); } }
public void AddUsersToRolesTest4() { try { AppleseedRoleProvider provider = Roles.Provider as AppleseedRoleProvider; Guid[] users = new Guid[1]; users[0] = Guid.NewGuid(); Guid[] roles = new Guid[1]; roles[0] = new Guid("F6A4ADDA-8450-4F9A-BE86-D0719B239A8D"); // Admins provider.AddUsersToRoles("Appleseed", users, roles); Assert.Fail(); } catch (AppleseedMembershipProviderException) { } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in AddUsersToRolesTest4" + ex.Message, ex); } }
public void AddUsersToRolesTest1() { try { AppleseedRoleProvider provider = Roles.Provider as AppleseedRoleProvider; string[] users = new string[1]; users[0] = "*****@*****.**"; string[] roles = new string[1]; roles[0] = "Admins"; provider.AddUsersToRoles(users, roles); Assert.Fail(); } catch (AppleseedMembershipProviderException) { } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in AddUsersToRolesTest1" + ex.Message, ex); } }