コード例 #1
0
        public static void ClassCleanup()
        {
            //We will remove our sample users
            var mpCleanup = new MemberProv();

            mpCleanup.Initialize("DormouseMembershipProvider", _testConfig);
            foreach (var user in _testUsers)
            {
                mpCleanup.DeleteUser(user.username, true);
            }

            //And our sample role
            var mpRoleCleanup = new RoleProv();

            mpRoleCleanup.Initialize("DormouseMembershipProvider", _testConfig);
            if (mpRoleCleanup.RoleExists("DefaultRole"))
            {
                mpRoleCleanup.DeleteRole("DefaultRole", false);
            }
            foreach (var role in _testRoles)
            {
                if (mpRoleCleanup.RoleExists(role))
                {
                    mpRoleCleanup.DeleteRole(role, false);
                }
            }
        }
コード例 #2
0
        public static void ClassCleanup()
        {
            //We will remove our sample users
            var mpCleanup = new MemberProv();
            mpCleanup.Initialize("DormouseMembershipProvider", _testConfig);
            foreach (var user in _testUsers)
            {
                mpCleanup.DeleteUser(user.username, true);
            }

            //And our sample role
            var mpRoleCleanup = new RoleProv();
            mpRoleCleanup.Initialize("DormouseMembershipProvider", _testConfig);
            if (mpRoleCleanup.RoleExists("DefaultRole"))
            {
                mpRoleCleanup.DeleteRole("DefaultRole", false);
            }
            foreach (var role in _testRoles)
            {
                if (mpRoleCleanup.RoleExists(role))
                {
                    mpRoleCleanup.DeleteRole(role, false);
                }
            }

        }
コード例 #3
0
        public void RoleExists_GivenGoodRole_ReturnsTrue()
        {
            //Arrange
            //Act
            var actual = _mProv.RoleExists("ValidRole");

            //Assert
            Assert.IsTrue(actual);
        }
コード例 #4
0
        public void CreateRole_GivenGoodRole_AddsRole()
        {
            //Arrange
            //Act
            _mpRole.CreateRole("SampleToAdd");
            var actual = _mpRole.RoleExists("SampleToAdd");

            _mpRole.DeleteRole("SampleToAdd", false);
            //Assert
            Assert.IsTrue(actual);
        }