예제 #1
0
        public void TestDeleteRule()
        {
            var systemFactory = new MockIptablesSystemFactory();
            var ipUtils       = new IpRuleController(systemFactory);

            ipUtils.Delete("from", "1.1.1.1", "lookup", "100");

            var expected = new List <KeyValuePair <String, String> >
            {
                new KeyValuePair <string, string> ("ip", "rule delete from 1.1.1.1 lookup 100")
            };

            CollectionAssert.AreEqual(expected, systemFactory.ExecutionLog);
        }
예제 #2
0
        public void TestDeleteRuleId()
        {
            var      systemFactory = new MockIptablesSystemFactory();
            var      ipUtils       = new IpRuleController(systemFactory);
            IpObject ipObject      = new IpObject();

            ipObject.Pairs.Add("pref", "100");
            ipObject.Pairs.Add("from", "1.1.1.1");
            ipUtils.Delete(ipObject);

            var expected = new List <KeyValuePair <String, String> >
            {
                new KeyValuePair <string, string> ("ip", "rule delete pref 100 from 1.1.1.1")
            };

            CollectionAssert.AreEqual(expected, systemFactory.ExecutionLog);
        }