Exemplo n.º 1
0
        public void CreateRoleTest1()
        {
            try {
                RainbowRoleProvider provider = Roles.Provider as RainbowRoleProvider;

                provider.CreateRole(Roles.ApplicationName, "editors");
                provider.CreateRole(Roles.ApplicationName, "clerks");
                provider.CreateRole(Roles.ApplicationName, "salesman");
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
                Assert.Fail("Error in CreateRoleTest1" + ex.Message, ex);
            }
        }
Exemplo n.º 2
0
        public void DeleteRoleTest2()
        {
            try {
                RainbowRoleProvider provider = Roles.Provider as RainbowRoleProvider;

                provider.CreateRole("tempRole1");
                provider.DeleteRole("tempRole1", true);
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
                Assert.Fail("Error in DeleteRoleTest2" + ex.Message, ex);
            }
        }
Exemplo n.º 3
0
        public void CreateRoleTest3()
        {
            try {
                RainbowRoleProvider provider = Roles.Provider as RainbowRoleProvider;

                provider.CreateRole(Roles.ApplicationName, "Admins,editors");
                Assert.Fail();
            }
            catch (RainbowRoleProviderException) {}
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
                Assert.Fail("Error in CreateRoleTest3" + ex.Message, ex);
            }
        }
Exemplo n.º 4
0
        public void DeleteRoleTest3()
        {
            try {
                RainbowRoleProvider provider = Roles.Provider as RainbowRoleProvider;

                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);
            }
        }