public void RemoveUsersFromRolesTest8() { try { RainbowRoleProvider provider = Roles.Provider as RainbowRoleProvider; 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 { RainbowRoleProvider provider = Roles.Provider as RainbowRoleProvider; 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 { RainbowRoleProvider provider = Roles.Provider as RainbowRoleProvider; bool isInRole = provider.IsUserInRole("*****@*****.**", "invalidRole"); Assert.Fail(); } catch (RainbowRoleProviderException) {} catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in IsUserInRoleTest3" + ex.Message, ex); } }
public void IsUserInRoleTest2() { try { RainbowRoleProvider provider = Roles.Provider as RainbowRoleProvider; bool isInRole = provider.IsUserInRole("*****@*****.**", "Admins"); Assert.Fail(); } catch (RainbowRoleProviderException) {} catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in IsUserInRoleTest2" + ex.Message, ex); } }
public void RemoveUsersFromRolesTest7() { try { RainbowRoleProvider provider = Roles.Provider as RainbowRoleProvider; Guid userId = new Guid("34ADB714-92B0-47ff-B5AF-5DB2E0D124A9"); // [email protected]; Guid[] users = new Guid[] { userId }; RainbowRole editors = provider.GetRoleByName("Rainbow", "editors"); Guid[] roles = new Guid[1]; roles[0] = editors.Id; provider.AddUsersToRoles("Rainbow", users, roles); Assert.IsTrue(provider.IsUserInRole("Rainbow", userId, editors.Id)); provider.RemoveUsersFromRoles("Rainbow", users, roles); Assert.IsFalse(provider.IsUserInRole("Rainbow", userId, editors.Id)); } catch (Exception ex) { Console.WriteLine(ex.Message); Assert.Fail("Error in RemoveUsersFromRolesTest7" + ex.Message, ex); } }