public void TestParseRuleSingle()
        {
            int                 localPort     = 80;
            IPAddress           remoteAddress = IPAddress.Parse("192.168.1.1");
            int                 remotePort    = 128;
            string              record        = $"X\tYes\tAllow\t{localPort}\t{remoteAddress}\t{remotePort}\tTCP";
            WindowsFirewallRule rule          = WindowsFirewallRuleParser.ParseRecord(
                WindowsFirewallRuleParserTest.HeaderIndex,
                record,
                '\t');

            Assert.AreEqual("X", rule.Name);
            Assert.IsTrue(rule.Enabled);
            Assert.IsTrue(rule.Allow);
            Assert.AreEqual(1, rule.LocalPorts.Ranges.Count);
            Assert.AreEqual(localPort, rule.LocalPorts.Ranges.Single().Low);
            Assert.AreEqual(localPort, rule.LocalPorts.Ranges.Single().High);
            Assert.AreEqual(1, rule.RemotePorts.Ranges.Count);
            Assert.AreEqual(remotePort, rule.RemotePorts.Ranges.Single().Low);
            Assert.AreEqual(remotePort, rule.RemotePorts.Ranges.Single().High);
            Assert.AreEqual(1, rule.RemoteAddresses.Ranges.Count);
            Assert.AreEqual(remoteAddress, rule.RemoteAddresses.Ranges.Single().Low);
            Assert.AreEqual(remoteAddress, rule.RemoteAddresses.Ranges.Single().High);
            Assert.AreEqual(6, rule.Protocol.ProtocolNumber);
        }
        public void TestParseRuleRanges()
        {
            int       localPortLow      = 80;
            int       localPortHigh     = 8080;
            IPAddress remoteAddressLow  = IPAddress.Parse("64.32.16.8");
            IPAddress remoteAddressHigh = IPAddress.Parse("128.64.32.16");
            int       remotePortLow     = 128;
            int       remotePortHigh    = 256;
            string    record            = $"X\tYes\tAllow\t{localPortLow}-{localPortHigh}\t" +
                                          $"{remoteAddressLow}-{remoteAddressHigh}\t" +
                                          $"{remotePortLow}-{remotePortHigh}\tUDP";
            WindowsFirewallRule rule = WindowsFirewallRuleParser.ParseRecord(
                WindowsFirewallRuleParserTest.HeaderIndex,
                record,
                '\t');

            Assert.AreEqual(1, rule.LocalPorts.Ranges.Count);
            Assert.AreEqual(localPortLow, rule.LocalPorts.Ranges.Single().Low);
            Assert.AreEqual(localPortHigh, rule.LocalPorts.Ranges.Single().High);
            Assert.AreEqual(1, rule.RemotePorts.Ranges.Count);
            Assert.AreEqual(remotePortLow, rule.RemotePorts.Ranges.Single().Low);
            Assert.AreEqual(remotePortHigh, rule.RemotePorts.Ranges.Single().High);
            Assert.AreEqual(1, rule.RemoteAddresses.Ranges.Count);
            Assert.AreEqual(remoteAddressLow, rule.RemoteAddresses.Ranges.Single().Low);
            Assert.AreEqual(remoteAddressHigh, rule.RemoteAddresses.Ranges.Single().High);
            Assert.AreEqual(17, rule.Protocol.ProtocolNumber);
        }