Exemplo n.º 1
0
 public CustomizeCodeDomService()
 {
     MakeResponseActionsEditable = ConfigHelper.GetAppSettingOrDefault("MakeResponseActionsEditable", false);
     Approver = new WhitelistBlacklistLogic(Config.GetHashSet("ActionsWhitelist", new HashSet <string>()),
                                            Config.GetList("ActionPrefixesWhitelist", new List <string>()),
                                            Config.GetHashSet("ActionsToSkip", new HashSet <string>()),
                                            Config.GetList("ActionPrefixesToSkip", new List <string>()));
 }
        public void WhitelistBlacklistLogic_WithBlacklists_Should_OnlyAllowNonBlacklisted()
        {
            var sut = new WhitelistBlacklistLogic(_emptySet, _emptyList, _pear, _or);

            Assert.IsTrue(sut.IsAllowed("apple"));
            Assert.IsTrue(sut.IsAllowed("banana"));
            Assert.IsFalse(sut.IsAllowed("pear"));
            Assert.IsFalse(sut.IsAllowed("orange"));
        }
        public void WhitelistBlacklistLogic_WithWhiteAndBlacklists_Should_OnlyAllowWhitelisted()
        {
            var sut = new WhitelistBlacklistLogic(_apple, _ba, _pear, _or);

            Assert.IsTrue(sut.IsAllowed("apple"));
            Assert.IsTrue(sut.IsAllowed("banana"));
            Assert.IsFalse(sut.IsAllowed("pear"));
            Assert.IsFalse(sut.IsAllowed("orange"));
        }
        public void WhitelistBlacklistLogic_WithNothing_Should_OnlyAllowAnything()
        {
            var sut = new WhitelistBlacklistLogic(_emptySet, _emptyList, _emptySet, _emptyList);

            Assert.IsTrue(sut.IsAllowed("apple"));
            Assert.IsTrue(sut.IsAllowed("banana"));
            Assert.IsTrue(sut.IsAllowed("pear"));
            Assert.IsTrue(sut.IsAllowed("orange"));
        }
Exemplo n.º 5
0
 public CodeWriterFilterService(ICodeWriterFilterService defaultService)
 {
     DefaultService = defaultService;
     Approver       = new WhitelistBlacklistLogic(Config.GetHashSet("EntitiesWhitelist", new HashSet <string>()),
                                                  Config.GetList("EntityPrefixesWhitelist", new List <string>()),
                                                  Config.GetHashSet("EntitiesToSkip", new HashSet <string>()),
                                                  Config.GetList("EntityPrefixesToSkip", new List <string>()));
     GenerateEntityRelationships = ConfigHelper.GetAppSettingOrDefault("GenerateEntityRelationships", true);
 }