コード例 #1
0
        public void GetRolesForUserTest2()
        {
            try {
                RainbowRoleProvider provider = Roles.Provider as RainbowRoleProvider;

                IList <RainbowRole> roles = provider.GetRolesForUser(Roles.ApplicationName, new Guid());
                Assert.Fail();
            }
            catch (RainbowRoleProviderException ex) {}
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
                Assert.Fail("Error in GetRolesForUserTest2" + ex.Message, ex);
            }
        }
コード例 #2
0
        public void GetRolesForUserTest3()
        {
            try {
                RainbowRoleProvider provider = Roles.Provider as RainbowRoleProvider;

                Guid userId = new Guid("34ADB714-92B0-47ff-B5AF-5DB2E0D124A9");   //"*****@*****.**"
                IList <RainbowRole> roles = provider.GetRolesForUser(Roles.ApplicationName, userId);
                Assert.AreEqual(roles.Count, 0);
            }
            catch (RainbowRoleProviderException) {}
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
                Assert.Fail("Error in GetRolesForUserTest3" + ex.Message, ex);
            }
        }
コード例 #3
0
        public void GetRolesForUserTest1()
        {
            try {
                RainbowRoleProvider provider = Roles.Provider as RainbowRoleProvider;

                Guid userId = new Guid("BE7DC028-7238-45D3-AF35-DD3FE4AEFB7E");   //"*****@*****.**"

                IList <RainbowRole> roles = provider.GetRolesForUser(Roles.ApplicationName, userId);
                Assert.AreEqual(1, roles.Count);
                Assert.AreEqual("Admins", roles[0].Name);
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
                Assert.Fail("Error in GetRolesForUserTest1" + ex.Message, ex);
            }
        }