Example #1
0
        public void TestSync(IpTablesRuleSet rulesOriginal, IpTablesRuleSet rulesNew, Func <IpTablesRule, IpTablesRule, bool> commentComparer = null)
        {
            IpTablesChain chain = rulesOriginal.Chains.First();

            DefaultNetfilterSync <IpTablesRule> sync = new DefaultNetfilterSync <IpTablesRule>(commentComparer, null);

            if (commentComparer == null)
            {
                chain.Sync(rulesNew.Chains.First().Rules, sync);
            }
            else
            {
                chain.Sync(rulesNew.Chains.First().Rules, sync);
            }
        }
Example #2
0
        public void TestSync <TSync>(INetfilterAdapterClient client, IpTablesRuleSet rulesOriginal, IpTablesRuleSet rulesNew, TSync sync, List <string> expectedCommands = null) where TSync : INetfilterSync <IpTablesRule>
        {
            IpTablesChain chain = rulesOriginal.Chains.First();

            chain.Sync(client, rulesNew.Chains.First().Rules, sync);

            if (expectedCommands != null)
            {
                CollectionAssert.AreEqual(expectedCommands, ExecutionLog.Select(a => a.Value).ToList());
            }
        }