コード例 #1
0
        public async Task WithBlacklistProvided_ThenReturnsValidWhitelistElements(string blacklist,
                                                                                  int numberOfElements)
        {
            // Given
            var blacklistStr = GetListFromStr(blacklist);

            // When
            var provider = new DefaultIpRulesProvider(null, blacklistStr);

            // Then
            Assert.NotNull(provider);
            var numberOfBlacklistElements = (await provider.GetIpRules()).Where(x => x.Type == IpRuleType.Blacklist);

            Assert.Equal(numberOfElements, numberOfBlacklistElements.Count());
        }
コード例 #2
0
        public async Task WithoutBlacklistAndWhitelistProvided_ThenReturnValidNUmberOfElements()
        {
            // When
            var provider = new DefaultIpRulesProvider(null, null);

            // Then
            Assert.NotNull(provider);
            var numberOfIpRules = await provider.GetIpRules();

            var numberOfWhitelistElements = numberOfIpRules.Where(x => x.Type == IpRuleType.Whitelist);

            Assert.Empty(numberOfWhitelistElements);

            var numberOfBlacklistElements = numberOfIpRules.Where(x => x.Type == IpRuleType.Blacklist);

            Assert.Empty(numberOfBlacklistElements);
        }