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 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 IsUserInRoleTest4() { try { AppleseedRoleProvider provider = Roles.Provider as AppleseedRoleProvider; bool isInRole = provider.IsUserInRole("*****@*****.**", "editors"); Assert.IsFalse(isInRole); } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in IsUserInRoleTest4" + ex.Message, ex); } }
public void IsUserInRoleTest3() { try { AppleseedRoleProvider provider = Roles.Provider as AppleseedRoleProvider; bool isInRole = provider.IsUserInRole("*****@*****.**", "invalidRole"); Assert.Fail(); } catch (AppleseedRoleProviderException) { } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in IsUserInRoleTest3" + ex.Message, ex); } }
public void IsUserInRoleTest2() { try { AppleseedRoleProvider provider = Roles.Provider as AppleseedRoleProvider; bool isInRole = provider.IsUserInRole("*****@*****.**", "Admins"); Assert.Fail(); } catch (AppleseedRoleProviderException) { } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in IsUserInRoleTest2" + ex.Message, ex); } }