public void TestPopulateDefaultRolesFromPhunCmsConfigurationSection()
        {
            // Arrange
            var attr = new CmsAdminAuthorizeAttribute();
            var expected = "test,test2";
            var authContext = new Mock<AuthorizationContext>();
            authContext.Setup(ac => ac.HttpContext.Request.Url).Returns(new Uri("http://localhost/BogusRoute"));

            // Act
            attr.PopulateRolesFromConfiguration(new PhunCmsConfigurationSection() { AdminRoles = expected }, authContext.Object);

            // Assert
            Assert.AreEqual(expected, attr.Roles);
        }
        public void TestOverrideDefaultRolesFromHostAuthorizationConfig()
        {
            // Arrange
            var attr = new CmsAdminAuthorizeAttribute();
            var expected = "local,local2";
            var authContext = new Mock<AuthorizationContext>();
            authContext.Setup(ac => ac.HttpContext.Request.Url).Returns(new Uri("http://localhost/BogusRoute"));
            var config = new PhunCmsConfigurationSection() { AdminRoles = "test,test2" };
            var expectedElement = new KeyValueConfiguration() { Key = "localhost", Value = expected };
            config.HostAuthorizations = (new KeyValueCollection()) as ICollection<IKeyValueConfiguration>;
            config.HostAuthorizations.Add(expectedElement);

            // Act
            attr.PopulateRolesFromConfiguration(config, authContext.Object);

            // Assert
            Assert.AreEqual(expected, attr.Roles);
        }