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 RemoveUsersFromRolesTest3() { try { AppleseedRoleProvider provider = Roles.Provider as AppleseedRoleProvider; string[] users = new string[1]; users[0] = "*****@*****.**"; string[] roles = new string[1]; roles[0] = "editors"; provider.RemoveUsersFromRoles(users, roles); // admin is in editors role } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in RemoveUsersFromRolesTest3" + 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 RemoveUsersFromRolesTest5() { 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.RemoveUsersFromRoles("Appleseed", users, roles); Assert.Fail(); } catch (AppleseedRoleProviderException) { } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in RemoveUsersFromRolesTest5" + ex.Message, ex); } }
public void RemoveUsersFromRolesTest4() { 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.RemoveUsersFromRoles("Appleseed", users, roles); Assert.Fail(); } catch (AppleseedRoleProviderException) { } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in RemoveUsersFromRolesTest4" + ex.Message, ex); } }
public void RemoveUsersFromRolesTest1() { try { AppleseedRoleProvider provider = Roles.Provider as AppleseedRoleProvider; string[] users = new string[1]; users[0] = "*****@*****.**"; string[] roles = new string[1]; roles[0] = "Admins"; provider.RemoveUsersFromRoles(users, roles); Assert.Fail(); } catch (AppleseedMembershipProviderException) { } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in RemoveUsersFromRolesTest1" + ex.Message, ex); } }